• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 291
  • Last Modified:

user enters datetime in M j, g:i A format, saved in mysql format and then displayed on the form again in M j, g:i A format

a user is entering time in an input textbox which gets saved into mysql and then displayed in the input textbox again

datetime in this format:
M j, g:i A

Mar 10, 6:05 PM


want to convert
to mysql format
Y-m-d H:i:s

and then back into
M j, g:i A

how to do the two conversions
0
rgb192
Asked:
rgb192
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
This should work.

$mysqldate = date("Y-m-d H:i:s", strtotime("Mar 10, 6:05 PM"));
$yourdate = date("M j, g:i A", strtotime("$mysqldate"));

Open in new window

0
 
rgb192Author Commented:
thank you for organizing dates
0
 
Dave BaldwinFixer of ProblemsCommented:
You're welcome.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now