Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2002
    Location
    Toronto, Canada
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    timestamp question ...

    I am not to sure how to do this ... i have a table with few fields .. and one of them is a TIMESTAMP. How can i display timestamp in proper format YYYY-MM-DD HH:MM ?

    I need to display the time / date on the browser

    Please help...

    HormonX
    Last edited by HormonX; 11-26-2002 at 04:02 AM.

  • #2
    New Coder
    Join Date
    Nov 2002
    Location
    Netherlands
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When entering data into your database use time() to get the value you put in the database, that's the standard unix time. ie the number of seconds since unix epoch (January 1 1970 00:00:00 GMT)

    Then when you're retrieving the data from your database use date() to convert that timestamp to human readible text. It's documented here.

    To get the format you described you'd use:

    date('Y-m-d H:i', timestamp);


  •  

    Posting Permissions

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