Click here to Skip to main content
15,849,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have a input text which has this type of date format: 28 May 2015 11:00 PM
Is there a way or a function that could change the format to: 2015-05-28 23:00:00 ?

Thank you for the help.

Take a look here: PHP: Date Formats[^]
It might be useful too: Convert one date format into another in PHP[^]
Share this answer
Consider the following Code segment:-

$input_date = date('d M Y h:i A'); 
echo $input_date; //01 Jun 2015 07:31 AM

$input_date_timestamp = strtotime($input_date);

$new_date = date('Y-m-d H:i:s', $input_date_timestamp); 
echo $new_date; //2015-06-01 07:31:00
Share this answer

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