Results 1 to 5 of 5
Thread: [php] Create time stamp
-
12-20-2008, 09:23 PM #1Web Hosting Master
- 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
-
12-20-2008, 10:04 PM #2Disturbed
- 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
-
12-21-2008, 02:52 AM #3Justin 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
-
12-21-2008, 07:04 AM #4Web Hosting Master
- 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
-
12-23-2008, 03:51 PM #5Newbie
- Join Date
- Dec 2005
- Posts
- 15
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.