Jump to content

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


thehigherentity

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
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.