Jump to content

Archived

This topic is now archived and is closed to further replies.

thehigherentity

how can I change this date 19760427 to this 27/04/1976

Recommended Posts

Im trying to find a way to convert dates that are stored in a database as E.G. 19760427 to 27/04/1976.

I cant change how they are saved as this "19760427" format is needed for a different part of the code but
I would like to be-able to display the date in this "27/04/1976" format too.

Any ideas ?
Its probaly simple but i have no idea....

Thanks to anyone in advance that can help

Share this post


Link to post
Share on other sites
Use the functions [url=http://www.php.net/date]date()[/url] and [url=http://www.php.net/strtotime]strtotime()[/url]:
[code]<?php echo date('d/m/Y',strtotime('19760427')); ?>[/code]

Ken

Share this post


Link to post
Share on other sites
[quote author=kenrbnsn link=topic=112068.msg454672#msg454672 date=1161294114]
Use the functions [url=http://www.php.net/date]date()[/url] and [url=http://www.php.net/strtotime]strtotime()[/url]:
[code]<?php echo date('d/m/Y',strtotime('19760427')); ?>[/code]

Ken
[/quote]
Thanks for that m8, I have been banging my head on the wall trying, I new it would be simple. Cant believe i never thought of the date function lol

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.