Portal Home > Knowledgebase > Articles Database > [php] Create time stamp
[php] Create time stamp
Posted by Georgecooldude, 12-20-2008, 09:23 PM |
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
|
Posted by csparks, 12-20-2008, 10:04 PM |
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
|
Posted by Justin M, 12-21-2008, 02:52 AM |
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
|
Posted by Georgecooldude, 12-21-2008, 07:04 AM |
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
|
Posted by vince2doom, 12-23-2008, 03:51 PM |
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.
|
Add to Favourites Print this Article
Also Read