Re: strtotime problem
| From: | Jason Pruim | Date: | Wed, 08 Oct 2008 12:08:43 +0000 |
| Subject: | Re: strtotime problem | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281589@lists.php.net to get a copy of this message | ||
On Oct 8, 2008, at 7:58 AM, Thodoris wrote:
I was just giving that as an option incase it's not already a timestamp :) I usually convert to timestamps as soon as the dates are given to the application and store them in the database.Of course this means that I will explode the date anyway so I will not need the intermediate transformation into timestamp.Well, If it's not already a timestamp, you can use mktime() to make it one, once it is then you should just be able to:Actually strtotime accepts all kinds of things... "Last week Thursday midnight" for example works perfectly. You could do an explode on the field and then reorder the array anyway that you want... <?PHP $date = "13/01/2008"; $datearray = explode("/", $date); echo $datearray[1] ."/". $datearray[0] . "/" . $datearray[2]; ?> Or something like that :) That wasn't tested but should give you an idea... php.net/explode for more info.This is what I was doing before (which is a bit lame) so I am looking for a more elegant way using timestamps.
As an American, I don't see a big issue with that :P But what Stut said is more then likely true... :)<?PHP $timestamp ="1222354037"; echo date("d/m/y h:i:s", $timestamp); ?> to format and display it. I'm using that on a time card application right now and it's working great. Is that more what you are looking for?Actually this means that strtotime() was made with Americans only in mind... :-) .
-- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com japruim@raoset.com