thehigherentity Posted October 19, 2006 Share Posted October 19, 2006 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 butI 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 Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 19, 2006 Share Posted October 19, 2006 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 Link to comment Share on other sites More sharing options...
buildakicker Posted October 19, 2006 Share Posted October 19, 2006 You can also use MKTIME(). date("Y", mktime(......)); Quote Link to comment Share on other sites More sharing options...
thehigherentity Posted October 19, 2006 Author Share Posted October 19, 2006 [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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.