I have:
var datatime = '2012-01-25 07:44:00';
How can i make object Datatime with this, and get only Hours? In php is option ->format(“H”). And here?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
datetime.substr(11,2)will give you the hour. Is there any reason you need to go to a Date object in the middle?Edit: The alternative with the Date object:
You need to replace the space in the string with a T to make it work reliably. This is the ISO 8601 date format (albeit without a timezone on the end)