Page 1 of 1

Undefined PHP fonction strptime() in XAMPP 1.6.4 for Windows

PostPosted: 23. November 2007 17:35
by verozg
Dear all,

I have install the last XAMPP version 1.6.4 on Windows XP Pro.
The uses of the PHP function strptime() leads to an error as below:
Fatal error: Call to undefined function strptime() in ....

The PHP doc says that the strptime is available since (PHP 5 >= 5.1.0).

The phpinfo() tells me that the PHP Version 5.2.4 is installed within XAMPP version 1.6.4.

Does someone tell me what is the problem ?
Thanks

PostPosted: 23. November 2007 17:51
by Wiedmann
Does someone tell me what is the problem ?

You have not read the manual page for strptime() ;-)

http://de.php.net/manual/en/function.strptime.php

PostPosted: 03. December 2007 10:04
by verozg
Thanks you for your answer. I missed this "detail".
I was thinking that PHP was interoperable.

Do you know which function I could use to replace the function strptime(). I use this function to transform a date in timestamp, where the date is given by a day, expressed by a number between 1 and 366, a year and a time.

thanks in advance

PostPosted: 03. December 2007 10:20
by Wiedmann
I use this function to transform a date in timestamp

That's curious, because you can't use this function to do this. Even on *nix.

Maybe you are searching for strtotime(), mktime() or gmmktime()?

PostPosted: 03. December 2007 10:47
by verozg
I forgot some detail:
As I have a day expressed by a number between 1 and 366, I use strptime() to retrieve the day of the month (1-31) and the month 's number (0-11); Then I used the function
mktime with arguments given by the array resulting of the strptime() function.

Ex:
$result= strptime ('2007 192 0815','%Y %j %H%M');
$time=mktime($result[tm_hour],$result[tm_min],0,$result[tm_mon]+1,$result[tm_mday],2007))

In this case, how to replace strptime() in order to retrieve the day of the month (1-31) and the month 's number from a day expressed by a number between 1 and 366 ?

Thanks in advance

PostPosted: 03. December 2007 11:06
by Wiedmann
Code: Select all
$result= strptime ('2007 192 0815','%Y %j %H%M');
$time=mktime($result[tm_hour],$result[tm_min],0,$result[tm_mon]+1,$result[tm_mday],2007))

how to replace strptime()

Code: Select all
$time = strtotime('2007-01-01 08:15 +192 days');