Click here to Skip to main content
15,916,462 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi everyone

i want to convert date into datetime using javascript.The input is :01:30pm and output:12/3/2013 01:30pm.can anyone tell me how to do it.

thanking you..
Posted
Comments
Richard C Bishop 3-Dec-13 12:30pm    
Well, from the looks of your data, you are attempting to convert a time to a datetime. That is not going to be possible. You have to have some sort of indication of a date in order to convert it or change the format.

1 solution

If you have the date in a string and the time in a string you could do it like this
JavaScript
var time = "01:30PM";
var date = "12/3/2013";
var newDate = new Date(date + " " + time);
 
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