Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2004
    Location
    London
    Posts
    887
    [php] Create time stamp

    Hey Guys
    I have broken my time down (badly) into
    $year,$month,$day,$hour,$minute,$second and I'm wondering how I can create a timestamp from this?
    Can anyone suggestion how I could do this?





    __________________
    ...loading

  2. #2
    Join Date
    Dec 2002
    Location
    Jackson, MI
    Posts
    1,525
    You can use mktime...
    PHP Code:



    mktime ( [int $hour [, int $minute [, int $second [, int $month [, int $day [, int $year [, int $is_dst]]]]]]] )




    Basically if you have broken your time down to each of those variables you can do this:
    PHP Code:



    $timestamp = mktime($hour,$minute,$second,$month,$day,$year);




    Hope that helps.





    __________________
    Craig Sparks | Web Developerhttp://www.jexlabs.com

  3. #3
    Justin M Guest
    There are a lot of ways to format dates and times with php. Do you have any preferences/ requirements on how it should look?





    __________________Deushost Image Hosting

  4. #4
    Join Date
    Aug 2004
    Location
    London
    Posts
    887
    I need to get my stampstamps in seconds.
    Eg phpBB gives me the following time
    1229600548 which it says equals
    Thu Dec 18, 2008 11:42 am
    I'm moving some of my data into phpBB and my time uses year/month/day/hour/minute/second so ive broken it into the individual variables and it can now be recontructed into phpbbs format.
    csparks, I just tried your second suggestion and it works perfectly fine. Does exactly what I'm trying to do. Thanks.





    __________________
    ...loading

  5. #5
    Quote:



    Originally Posted by Georgecooldude


    I need to get my stampstamps in seconds.
    Eg phpBB gives me the following time
    1229600548 which it says equals
    Thu Dec 18, 2008 11:42 am
    I'm moving some of my data into phpBB and my time uses year/month/day/hour/minute/second so ive broken it into the individual variables and it can now be recontructed into phpbbs format.
    csparks, I just tried your second suggestion and it works perfectly fine. Does exactly what I'm trying to do. Thanks.




    Well it's only 1 suggestion ! The first "suggestion" is an explanation of the function.

Posting Permissions

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