On 16 January 2004 11:14, Tom wrote: > Is there a way I can force PHP's time functions not to read > date strings > in the American MM-DD-YYYY format? > > I am using strtotime and strftime and date at various points (mainlty > to avoid some niggly 0/NULL problems between PHP and mySQL > and datefields). > > My date calculations (which are done in mySQL) are coming out with > screwy results: adding 6 months the 3rd July becomes 7th September. > ("03/07/2004" reads as 7th March, add six months for 7th September > which is then displayed as "07/09/2003"). > > Is there a way I can have strtotime read "10-01-2004" (and > all other such > date connotations) as the 10th Jan and not 1st Oct?
No. strtotime() only recognises the formats mm/dd/yyyy, yyyy-mm-dd and yyyymmdd for numeric months; if you use a textual month, you can pretty much put the day, month and year in any order. Your best bet is to rejig the date into one of the formats recognised before passing it to strtotime -- although, once you've split it into its constituent parts, you might just as well use mktime() to get your timestamp. And if you just want to insert into mySQL, why not use the mySQL date format specifiers to specify the format of your incoming dates? (Someone else can expound better on this, as I don't use mySQL.) Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php