★ wanayoo — archive 1999 http://www.php.net/manual/function.strtotime.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Date/time
Quick Reference
German version of this pageJapanese version of this pageItalian version of this pageHungarian version of this page
Date/time
* checkdate
* date
* getdate
* gettimeofday
* gmdate
* gmmktime
* gmstrftime
* localtime
* microtime
* mktime
* strftime
* time
* strtotime
Manual: strtotime
View the source code for this pageSearch the site



Previous page
 time
 Updated
Sat, 12 Aug 2000
dBase 
Next page


strtotime

(PHP3 >= 3.0.12, PHP4 >= 4.0b2)

strtotime --  Parse about any english textual datetime description into a UNIX timestamp

Description

int strtotime (string time [, int now])

The function expects to be given a string containing an english date format and will try to parse that format into a UNIX timestamp.

Example 1. Strtotime() example


echo strtotime ("10 march 2000") . "\n";
      


User Contributed Notes: strtotime


pop3@f2s.com
01-Jul-2000 03:18
it seems what you cannot pas to strtotime() function string containing more spaces than required:
"Wed Jun 7 09:13:58 2000 -0800" (after 'Jun' there are 2 spaces)

php even crashes in such situation



dadams@bulbs.com
08-Jul-2000 05:08
Is there any quick way to get the current date and time. Also, is there a way to do something like strtotime ("now + 30 days"); ?


brett@socket7.net
08-Jul-2000 07:55
Try:

$now = time();
$thirty_days_from_now = ($now+2592000);




12-Jul-2000 01:00
strototime( "2000-01-01 00:00" ) only works in the latest version of PHP.


bens@saber.net
20-Jul-2000 08:10
I've noticed -- date functions are very WEAK at best with PHP.

This is one area that needs some attention!

Also, for some reason, if I input "July 25, 2000, convert to unix timestamp, and then use date("m/d/Y") I get 07/24/2000!

There's a BUG here someplace... (using 4.0.1 PHP)



paul@silksystems.com
21-Jul-2000 08:34
<pre>
yup - theres definately a bug in this func - it seems to loose a day when parsing the time.

you put in 07/21/2000 - it returns 07/20/2000
</pre>



chuck@leaseyourmind.com
24-Jul-2000 10:37
As seen on the bugs page, this time loss is due to timezone settings.


jsteele@srksys.com
03-Aug-2000 10:57
The lost day bug I think has to do with the timestamp. At least in my case if you do not specify a time on your date then when the date is inserted into you db with a unix time stamp it inserts 00:00:00 or something like that... according to php that is not actually the day but the day before. so Tue Jul 11 00:00:00 2000 PDT is seen by php as Wed Jul 10 2000 since the hours, minutes and seconds are all zero. Anyone have a work around?
-joel



antti@artecdesign.ee
14-Aug-2000 06:44
It seems like strtotime adds some missing parts to the string given. I thought that it'd be nice way to convert times (from 00:00:00 to 23:59:59) to seconds but no. When I gave some timestring to strtotime then it returned me smth like "08/14/2000 10:00:00" (timestamp converted by strftime).
IMHO it would be nice if this function would'nt decide what I want but would let ME to decide what I want to get out of it.



 About Notes


Previous page
 time
 Updated
Sat, 12 Aug 2000
dBase 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.