Jump to content


Photo

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


  • Please log in to reply
3 replies to this topic

#1 thehigherentity

thehigherentity
  • Members
  • PipPipPip
  • Advanced Member
  • 49 posts

Posted 19 October 2006 - 09:37 PM

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
The best way to learn
is to ask you lot........

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 19 October 2006 - 09:41 PM

Use the functions date() and strtotime():
<?php echo date('d/m/Y',strtotime('19760427')); ?>

Ken

#3 buildakicker

buildakicker
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 19 October 2006 - 09:43 PM

You can also use MKTIME(). date("Y", mktime(......));



#4 thehigherentity

thehigherentity
  • Members
  • PipPipPip
  • Advanced Member
  • 49 posts

Posted 19 October 2006 - 10:46 PM

Use the functions date() and strtotime():

<?php echo date('d/m/Y',strtotime('19760427')); ?>

Ken

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
The best way to learn
is to ask you lot........




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users