new Date(entry["startdatetime"]).toLocaleTimeString().replace(/([\d]+:[\d]{2})(:[\d]{2})(.*)/, "$1$3")
我如何将服务器时间转换为当地时间现在我的时间是18:30相当于下午6:30。
我的new Date(entry["startdatetime"])
值为
服务器时间如下:
请有人帮忙
答案 0 :(得分:0)
<% new SimpleDateFormat("dd-MMM-yyyy").format(new Date()) %>
这可用于打印14-oct-2014
如果找到,请使用my date: <%= new java.util.Date() %>
= out put
my date: Tue Oct 14 10:52:39 IST 2014
。使用这种语法我认为这将解决您的问题。
答案 1 :(得分:0)
function convertTime(serverdate) {
var date = new Date(serverdate);
// convert to utc time
var toutc = date.toUTCString();
//convert to local time
var locdat = new Date(toutc + " UTC");
return locdat;
}