Re: [PHP] how to use the function "strtotime"
From: ~~~i LeoNid ~~ <[EMAIL PROTECTED]> Date: Fri, Sep 21, 2001 at 02:31:09PM + Message-ID: <3bab4e57.9001311@localhost> Subject: Re: [PHP] how to use the function "strtotime" > On Thu, 20 Sep 2001 11:49:02 +0200 impersonator of [EMAIL PROTECTED] (* > R&Ze:) planted &I saw in php.general: > > >It's not all that difficult, really. It's exactly how it's described > > Well. They don't describe (in my copy of documentation, at least:) a > return on error. And it dosn't blew up an error message. I had to find it > by myself. It (in 4.0.6, at least) returns -1 on erroneous data supply. > > Make sure, you check for that, if, like, you convert user data, otherwise > it will blow up on its further processing. > -- > i leonid http://nux.home.dk3.com :) I've posted it... It should be in the documentation soon :) -- * R&zE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] how to use the function "strtotime"
On Thu, 20 Sep 2001 11:49:02 +0200 impersonator of [EMAIL PROTECTED] (* R&Ze:) planted &I saw in php.general: >It's not all that difficult, really. It's exactly how it's described Well. They don't describe (in my copy of documentation, at least:) a return on error. And it dosn't blew up an error message. I had to find it by myself. It (in 4.0.6, at least) returns -1 on erroneous data supply. Make sure, you check for that, if, like, you convert user data, otherwise it will blow up on its further processing. -- i leonid http://nux.home.dk3.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] how to use the function "strtotime"
thank a lot , I learn a lot from reply from you ! "* R&Ze:" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > From: mydata <[EMAIL PROTECTED]> > Date: Thu, Sep 20, 2001 at 11:41:09AM +0800 > Message-ID: <[EMAIL PROTECTED]> > Subject: [PHP] how to use the function "strtotime" > > > Hi, > > I'm php developer beginner in China,but I am confused with function > > "strtotime". > > yes ,I know the usage of function "strtotime" in php manual. But description > > of php manual about it is too little.I want to know more about it. > > > > > > It's not all that difficult, really. It's exactly how it's described > in the manual. Here is some code that runs some samples: > > (I must say, though, that most examples can be done a lot easier > without strtotime(), but 'cause these are examples of strtotime()... > well... you know :) > > --- PHP Example Code --- > > > /* Show a given date (+time) */ > print ("Date: \n\t"); > print (date ("r", strtotime ("January 31 2000 19:20:15"))."\n\n"); > > /* Show the current date (+time) */ > print ("Now: \n\t"); > print (date ("r", strtotime ("now"))."\n\n"); > > /* Show the date (+time) of tomorrow */ > print ("Tomorrow: \n\t"); > print (date ("r", strtotime ("tomorrow"))."\n\n"); > > /* Show the date (+time) of yesterday */ > print ("Yesterday: \n\t"); > print (date ("r", strtotime ("yesterday"))."\n\n"); > > /* Show the date (+time) of yesterday, where now is tomorrow. So the >the output will be today :) */ > print ("Yesterday, where 'now' is tomorrow: \n\t"); > print (date ("r", strtotime ("yesterday", strtotime("tomorrow")))."\n\n"); > > /* Show the date (+time) 13 days from december 24th 1998 */ > print ("13 days from december 24th 1998: \n\t"); > print (date ("r", strtotime ("+13 days", strtotime("December 24 1998")))."\n\n"ยป > > /* Let's say you get some date from the db (or something) and you > * want to >add 2 years and 4 months and 23 days. */ > print ("Well... just see: \n\t"); > $date_from_db = "2001-09-20"; > print (date ("r", strtotime ("+2 years +4 months +23 days", > mktime(0,0,0,substr($date_from_db, 5, 2), > substr($date_from_db, 8, 2), > substr($date_from_db, 0, 4."\n\n"); > > /* Etc. */ > print ("And so on... :)"); > > ?> > > --- End of PHP Example Code --- > > > > -- > > * R&zE: > > > -- > -- Renze Munnik > -- DataLink BV > -- > -- E: [EMAIL PROTECTED] > -- W: +31 23 5326162 > -- F: +31 23 5322144 > -- M: +31 6 21811143 > -- > -- Stationsplein 82 > -- 2011 LM HAARLEM > -- Netherlands > -- > -- http://www.datalink.nl > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] how to use the function "strtotime"
From: mydata <[EMAIL PROTECTED]> Date: Thu, Sep 20, 2001 at 11:41:09AM +0800 Message-ID: <[EMAIL PROTECTED]> Subject: [PHP] how to use the function "strtotime" > Hi, > I'm php developer beginner in China,but I am confused with function > "strtotime". > yes ,I know the usage of function "strtotime" in php manual. But description > of php manual about it is too little.I want to know more about it. It's not all that difficult, really. It's exactly how it's described in the manual. Here is some code that runs some samples: (I must say, though, that most examples can be done a lot easier without strtotime(), but 'cause these are examples of strtotime()... well... you know :) --- PHP Example Code --- "); ?> --- End of PHP Example Code --- -- * R&zE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] how to use the function "strtotime"
Hi, I'm php developer beginner in China,but I am confused with function "strtotime". yes ,I know the usage of function "strtotime" in php manual. But description of php manual about it is too little.I want to know more about it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]