Re: converting seconds since unix epoc to date array

From: Date: Tue, 07 Sep 2004 04:12:12 +0000
Subject: Re: converting seconds since unix epoc to date array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-196012@lists.php.net to get a copy of this message
Hi, Try $date="YYYY-MM_DD"; $da=explode("-",$date); Now $Y=$da['0']; $M=$da['1']; $D=$da['2']; then use mktime(); Hope you will get the results. zareef ahmed --- Jason FB <jasonfb@earthlink.net> wrote: > Can anyone tell me how to convert a date stored in > the format > "YYYY-MM-DD" to an integer of seconds since unix > epoc, > > then add $daysToAdd days to this value (I suppose if > the integer was > a number of seconds it would have to be > $daysToAdd*60*60*24 to get > the number of seconds to add) > > then convert the new value to a timestamp which I > can output using the function > > string date ( string format [, int timestamp]) > > I tried doing this with mktime() and couple > different ways using > strtotime() and also with strftime() but I kept > getting -1 as the > result for strtotime() indicating the function > couldn't interpret the > given date. > > I've been through all the date-related functions in > the manual I can > think of, but I'm stumpped on this one... ===== Homepage :: http://www.zasaifi.com __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo

« previous php.general (#196012) next »