Thread: strptime
View Single Post
Old 04-13-2009, 10:31 PM   #1 (permalink)
Kalle
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default strptime

Hey

So I've been playing about with BSD's strptime() implementation (written in C). Currently PHP does not support strptime() on Windows because the lack of that function in Microsoft's Standard C Library, however I was wondering if anyone of you non Windozers could try the following script (under prefered the most recent version of php) and post the output:

PHP Code:
<?php
    date_default_timezone_set
('UTC');

    
$format '%d/%m/%Y %H:%M:%S';
    
$strf strftime($formatmktime(1554191032004));

    echo 
"$strf\n";

    
print_r(strptime($strf$format));
?>
Currently on my local Windows build I get:
Code:
03/10/2004 15:54:19
Array
(
    [tm_sec] => 19
    [tm_min] => 54
    [tm_hour] => 15
    [tm_mday] => 3
    [tm_mon] => 9
    [tm_year] => 34
    [tm_wday] => 0
    [tm_yday] => 0
    [unparsed] =>
)
Comparing it to a result generated by a Linux box:
Code:
03/10/2004 15:54:19
Array
(
    [tm_sec] => 19
    [tm_min] => 54
    [tm_hour] => 15
    [tm_mday] => 3
    [tm_mon] => 9
    [tm_year] => 104
    [tm_wday] => 0
    [tm_yday] => 276
    [unparsed] => 
)
Which indicates that the tm_year is off by 70 in my sample and the tm_yday isn't even getting set. So I'm eager to find out the results so I can compare if they are consistent, and if anyone got a *BSD box and is able to run this script on it and tell me the results it would be just perfect! =)


Cheers
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote