SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot codewrecker's Avatar
    Join Date
    Feb 2002
    Location
    U.S.A.
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    unix time stamp using php

    all,
    I'm really struggling with this one but I think it has a simple solution and that's whats so darn aggravating about it.

    I am working with a database that uses a unix time stamp.Here's the situation:
    1. I am extracting the time stamp from a mysql database.
    2. I am then using a while loop to print the data. one element of which is the time stamp. (the script will print the time stamp)
    3. I would really like to use php to format the date.
    4. i've used the php date_format function before but this does not seem to work with the unix time stamp.

    I have searched and read some past posts about the unix time stamp and have tried some of the ideas but with no luck. any tidbit of advise or small piece of code would be great. I'm thinking there's got to be a simple way to do this.

    thanks,
    CodeWrecker

  2. #2
    SitePoint Wizard Crowe's Avatar
    Join Date
    Nov 2001
    Location
    Huntsville
    Posts
    1,117
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    wrong function use date() instead, like so:

    PHP Code:
    $formatted_date date("m/d/y",$myrow[unixtimestap]); 
    Hope that helps.
    Chrispian H. Burks
    Nothing To Say

  3. #3
    SitePoint Zealot codewrecker's Avatar
    Join Date
    Feb 2002
    Location
    U.S.A.
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Crowe,
    thanks a bunch...that worked! it was just what i was looking for.
    CodeWrecker

  4. #4
    SitePoint Wizard Crowe's Avatar
    Join Date
    Nov 2001
    Location
    Huntsville
    Posts
    1,117
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Anytime
    Chrispian H. Burks
    Nothing To Say


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
  •