如何将日期转换为日期时间 [英] How to convert date into datetime

查看:134
本文介绍了如何将日期转换为日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



i希望使用javascript将日期转换为datetime。输入为:01:30pm并输出:12/3/2013 01:30 pm.can有谁告诉我怎么做。



感谢你..

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..

推荐答案

如果你有约会对象在一个字符串和字符串中的时间你可以这样做

If you have the date in a string and the time in a string you could do it like this
var time = "01:30PM";
var date = "12/3/2013";
var newDate = new Date(date + " " + time);


这篇关于如何将日期转换为日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆