Results 1 to 5 of 5

Thread: Gmt time

  1. #1
    Join Date
    Jul 2008
    Posts
    81
    Thanks
    38
    Thanked 2 Times in 2 Posts

    Default Gmt time

    Hi

    I'm trying to create a simple guest book, which should also write the date&time of the post, in the following way: 04/08/08 13:50.

    In a regular PHP code I'm using GMT in order to see the right date&time, but here I don't really know what's the best way to store this kind of data in my database, and then print it, in this structure: 04/08/08 13:50.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    I would recommend using a UNIX timestamp. Then use the date function to format it the way you want.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. The Following User Says Thank You to thetestingsite For This Useful Post:

    lord22 (08-08-2008)

  4. #3
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default

    I am using what testing said, I save everything as the unix timestamp using time()

    Then when you want to display, use date( format [, timestamp ] )

    In all the examples I see, the timestamp is set using mktime, but I went and did my own testing and it can jsut be a unix timestamp.

  5. The Following User Says Thank You to motormichael12 For This Useful Post:

    lord22 (08-08-2008)

  6. #4
    Join Date
    Jul 2008
    Posts
    81
    Thanks
    38
    Thanked 2 Times in 2 Posts

    Default

    Thank you, I'll check this out!

  7. #5
    Join Date
    Aug 2008
    Location
    Worldwide
    Posts
    11
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Or convert it in the sql query, by using date_format()

Bookmarks

Posting Permissions

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