Solved

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

Posted on 2013-05-21
3
280 Views
Last Modified: 2013-05-22
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
Comment
Question by:rgb192
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39186605
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
 

Author Closing Comment

by:rgb192
ID: 39186744
thank you for organizing dates
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39186766
You're welcome.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
advertisement module in core php 4 87
MYSQL simple update statement 3 32
Time difference 10 35
session dropped in IE 10 20
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now