Results 1 to 6 of 6

Thread: Converting mysql time stamp into php

  1. #1
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default Converting mysql time stamp into php

    Hi friends... I have a table, in which i had stored the date with timestamp... Now i want to retrieve that value into php..plz give me the snippet of code how i can convert this value into proper readable date...

  2. #2
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    http://www.dynamicdrive.com/forums/s...ad.php?t=42374

    If this doesn't answer your question, you are going to have to give more information.

    The format of your timestamp in MYSQL would be a good place to start.

    I am assuming it is the standarad MySQL datetime, but who knows.

  3. #3
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default

    ok... then give me sughgestions how i can store date and time in MySQL databse that is easy to retrieve in PHP n i can use it for calculating dates for web page.... means in which format i should save the date value in table..?

  4. #4
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    This is the format: 2009-03-09 16:43:19

    The field TYPE is DATETIME .

  5. #5
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default

    actually i want to calculate time n dates

    suppose sm1 feeds data on 31-10-2009 at 11:00am so "today" with time must b printed on page...and so on..

    means on 30-11-09 it must b printed as "on month before" on screen

  6. #6
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,734
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    Quote Originally Posted by gurmeet View Post
    actually i want to calculate time n dates

    suppose sm1 feeds data on 31-10-2009 at 11:00am so "today" with time must b printed on page...and so on..

    means on 30-11-09 it must b printed as "on month before" on screen
    Could you rephrase that using better grammar? I just can't understand what you're trying to say.

    I can say that datetime does store both the date and the time into your table.
    To choose the lesser of two evils is still to choose evil. My personal site

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
  •