Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to change the date format the original date id (year-moth-day) but i am require is (month/day/year) formate to store the date
Posted

1 solution

Use "date" to format it as you can see here:
date('d/m/Y H:i:s',strtotime($strThatContainsTheMySQLReturnedDate))

You can get more information here[^].

Hope this helps! :thumbsup:
 
Share this answer
 
Comments
pucit009 1-Jun-11 5:11am    
i am not fully under stand if you give me peace of code i am realy very thanks to you.
Joan M 1-Jun-11 5:31am    
This will allow you to get the text formatted in the way you desire... so inside the database you can get the date and time stored in the native format and then, when getting values, formatting them to show them to the user in the desired way... i.e. using date to format the resulting text using the template/mask from the strtotime(stringfromDatabase)... The code you can see in the original answer is all the code you need to get it working. I hope to have clarified that a little bit more... ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900