How to set mysql date from a result set to a php datetime object?
-
i am trying to set the date and time (DateTime stored in mysql database) to a php DateTime object, one way is to override the class some how to make that happen, but is there any easier way than that? e.g. $date = new DateTime(); $date->setDate($mysql_resultset['date_… and then format that date according and display it.
-
Answer:
$date = date('Y-m-d',strtotime($date_from_mysql)… you can use any date formatting as first parameter, second is date string.
Ayub Zafar at Yahoo! Answers Visit the source
Related Q & A:
- When i do a search and click on a result a get a page addressed rc10 overture what do i do?Best solution by Yahoo! Answers
- How can I transfer video from a dvr box to a computer?Best solution by Yahoo! Answers
- How do I go about getting a job working in a recording studio?Best solution by Yahoo! Answers
- How do you import video from a Sony Handycam to a computer?Best solution by Yahoo! Answers
- How to set up outlook with a yahoo plus account using optimum isp?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.