English 中文(简体)
javascript setUTCMilliseconds is wrong? 否则,我就错了。
原标题:javascript setUTCMilliseconds is wrong? Otherwise, I m wrong

一、执行标准 我拿到了我所说的任何价值的错误日期。 这里只是一个错误价值的例子。 我的所有测试数据均在联合材料中决定到5月24日(从现在起),但在C#,或使用快速在线转换工具,我的航空卫星管理系统是正确的。

任何想法?

function parseDate(epoch) {   
    var d = new Date();

    //tried this too, but it shows me the actual epoch 1970 date instead
    //var d = new Date(0);

    //EDIT: this should be seconds in combination with Date(0)
    d.setUTCMilliseconds(parseInt(epoch)); 

    return d.toString();
}

 // 1336423503 -> Should be Mon May 07 2012 13:45:03 GMT-7

 // javascript says
 Thu May 24 2012 05:03:21 GMT-0700 (Pacific Daylight Time) 
最佳回答

类似问题:

var utcMilliseconds = 1234567890000;
var d = new Date(0); // The 0 there is the key, which sets the date to the epoch
d.setUTCMilliseconds(utcMilliseconds);

.

问题回答

2. 将“UTC”时间转至当地日期物体:

function makeUTC(secs) {
  return new Date(Date.UTC(1970,0,1,0,0, secs, 0));
}

注: 宇宙号为1970-01T00:00.0Z

Just use the Date( a. 体力结构:

> new Date(1336423503 * 1000)
2012-05-07T20:45:03.000

没有必要再设定一个日期标语,然后确定中间值。





相关问题
Mysql compaire two dates from datetime?

I was try to measure what is faster and what should be the best way to compare two dates, from datetime record in MySql db. There are several approaches how to grab a date from date time, but I was ...

iPhone Date Picker rolls over to 2010 on December 27th?

So I implemented a UIDatepicker in one of my applications for scheduling and autodialing teleconferences... everything is pretty much ready to go except, while testing I noticed that when the date ...

Convert date Python

I have MMDDYY dates, i.e. today is 111609 How do I convert this to 11/16/2009, in Python?

specifying date format when using $form->inputs() in CakePHP

I am wondering if there is a way to specify the date format in the forms created using CakePHP s $form->inputs(); Please note that this is not the individual $form->input() but instead $form->inputs() ...

NSDateFormat, super simple! Where am I screwing up?

Ok, this is really simple, maybe I m a getting a bit burnt out, but seems like it should work, Query XML feed, put out date string, format, display in a cell. The issue is I m a getting a NULL ...

sqlite writing a date into an email

I am exporting a date value from sqlite and placing it into an email. The date appears like this 279498721.322872 I am using Objective C in an Iphone App. Does anyone know how to make this export ...

热门标签