English 中文(简体)
贾瓦伦古斯塔(签名) 目标年复一年(和其他年)
原标题:JavaScript date() Object returns NaN with getYear (and other)

我目前正在提出一些问题,以改写明日期。 贾瓦文中的时间标

我假定,是因为我的扼杀不能在“新日期”(<>)中适当使用,但我不敢肯定这是问题。

我的投入:“2011-09-29 14:58:12”

我的法典:

var date = "2011-09-29 14:58:12";
var added = new Date(date);
var year = added.getYear();

然而,我的<代码>年 阿尔瓦中载有NaN. Same,有的是SapDay()或获得Month()。 问题是什么?

页: 1 使用土 Titan移动的Im是所涉的唯一东西。

最佳回答

您依靠Date Constructionor parsing an un Support Format。 直到最近,在<代码>Date的构造的支持下,有no标准方位格式。 欧共体第5号法规中有一个()。 YYYY-MM-DDTHH:MM:SS, note the T, but it s only was specified for only under two years and naturally don t work in long browsers.

目前,你的最佳灯塔是把它 yourself起来(你可以在上找到代码)。 这个问题及其答复,或使用诸如https://github.com/datejs/Datejs” rel=“nofollow noreferer”>、DateJS等。

问题回答

暂无回答




相关问题
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 ...

热门标签