Page 1 of 1

Time convertion

Posted: Thu Jan 12, 2012 7:24 pm
by jonas89
Hi, I am try to convert this : Thu, 12 Jan 2012 11:18:06 +0100 to something more neat and short like 12.01.2012 for my website. I tried doing some research, but I'm stuck. Help is much appreciated.

Re: Time convertion

Posted: Thu Jan 12, 2012 7:28 pm
by Vegan
I use

Code: Select all

date ("F d, Y (H:i:s)", getlastmod());
Now if you notice, I use a comma after the day to make the date more normal

you could use the period easy

Code: Select all

date("F.d.Y")
easy once you have the a couple of code snippets to look at

Re: Time convertion

Posted: Thu Jan 12, 2012 9:26 pm
by Christopher
jonas89 wrote:Hi, I am try to convert this : Thu, 12 Jan 2012 11:18:06 +0100 to something more neat and short like 12.01.2012 for my website. I tried doing some research, but I'm stuck. Help is much appreciated.
Try:

Code: Select all

$timestamp = strtotime('Thu, 12 Jan 2012 11:18:06 +0100');
echo date('m.d.Y', $timestamp);

Re: Time convertion

Posted: Fri Jan 13, 2012 9:39 am
by jonas89
Wicked, it worked perfectly Christopher