0

i am trying to write a program but i have no idea what to with parsing a date in this format into into a date stamp

Jan 15 2005 12:00AM

i do not care about the 12:00AM as all the records have that 12:00AM appended to them.

3 Answers 3

6

Use strtotime() to convert the date to unix timestamp. You can also use this timestamp with date() function to format it in any way you want.

Sign up to request clarification or add additional context in comments.

Comments

2

Use the strtotime() function ... e.g.: $new_date = strtotime("Jan 15 2005 12:00AM");

Comments

0

A newer way to do this as of PHP 5.2 is to use the DateTime class:

$datetime = new DateTime("Jan 15 2005 12:00AM");
echo $datetime->format('Y-m-d');

See it in action

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.