0

I have a datepicker using https://eonasdan.github.io/bootstrap-datetimepicker/#minimum-setup

My input type is Text. The input I receive will be: 02/14/2017 3:00 PM

How can I turn this into a php timestamp? Like this: 2017-02-14 15:00:00

I want to store it in my mySQL datebase as a timestamp.

1
  • use strtotime it will convert string to unix timestamp. And store that in database. Commented Feb 12, 2017 at 3:04

1 Answer 1

1

Use date() to reformat the text.

For example:

echo(date('Y-m-d H:i:s', strtotime($oldDate)))
Sign up to request clarification or add additional context in comments.

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.