Results 1 to 5 of 5

Thread: Date Problem

  1. #1

    * Date Problem

    Hello all
    I am using this code to insert the current date in My SQL but I am not getting the correct result Hope my friends would help me here
    PHP Code:
    $A getdate();
    $Today mktime(0,0,0,$A['mon'], $A['mday']+15$A['year']); 
    Thanks in advance

  2. #2
    Quote Originally Posted by imran7706
    Hello all
    I am using this code to insert the current date in My SQL but I am not getting the correct result Hope my friends would help me here
    PHP Code:
    $A getdate();
    $Today mktime(0,0,0,$A['mon'], $A['mday']+15$A['year']); 
    Thanks in advance

    Why dont you just use somthing like,
    Code:
    insert into table(date) values(NOW())
    That will insert the current date, if the structure of that column is set to DATE
    <<Please see rules for signature setup>>

  3. #3
    Join Date
    May 2005
    Location
    South Africa
    Posts
    17
    If you are using the MySQL DateTime variable type then in PHP you would use the following format

    Code:
    return gmdate("Y-m-d H:i:s", time() + 3600*$gmt);
    for comparing, inserting, etc

    An example date format will look like this: 2006-02-02 23:23:27

    The $gmt is your time zone. (You can also add or subtract time this way)
    Wim

    www.matogen.com - Corporate Web Development

  4. #4
    Thanks it worked thanks again

  5. #5
    Join Date
    Dec 2003
    Posts
    936
    Quote Originally Posted by Oshaka
    Why dont you just use somthing like,
    Code:
    insert into table(date) values(NOW())
    That will insert the current date, if the structure of that column is set to DATE
    This command will insert the time from the MySQL server. What he wanted is to insert the time from the server where php is running
    Primary email: advanced dot programmer at gmail dot com ..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •