0

I have a quastion. So I get from server a variable with date-time string which looks like this: '31/08/2015 13:24'. How can extract from this string separately date and time?

1 Answer 1

1

You could split the string:

var dateTime = '31/08/2015 13:24'.split(" ");
console.log(dateTime[0]); //date
console.log(dateTime[1]); //time

Or use js Date object to get the day, month, year, hours, etc:

var dateTime = new Date('31/08/2015 13:24');
Sign up to request clarification or add additional context in comments.

1 Comment

No problem. Glad to help :)

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.