[SOLVED] - Date Structuring
Moderator: General Moderators
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
since the date is all screwed up in ddmmyy format, which neither sorts naturally nor is welcomed by any functions, you'll have to plug in a bit more code than that I'm afraid 
For the sake of space I'm going to make a reference to your long-ass-variable (which is fine, don't get me wrong!)
substr() returns substrings of your date format for month, day and year (in that order, which mktime() wants)
mktime() makes a unix timestamp out of those variables
strtotime() adds 2 weeks to it
finally date() turns it back into your strange date format.
It's kludgy but it works.
Cheers,
Kieran
For the sake of space I'm going to make a reference to your long-ass-variable (which is fine, don't get me wrong!)
Code: Select all
$fc=&$frequencycurrent;
$fc = date('dmy',strtotime('+2 weeks',mktime(0,0,0,substr($fc,2,2),substr($fc,0,2),substr($fc,4,2))));mktime() makes a unix timestamp out of those variables
strtotime() adds 2 weeks to it
finally date() turns it back into your strange date format.
It's kludgy but it works.
Cheers,
Kieran
- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia