English 中文(简体)
AS3今天已经结束。
原标题:AS3 get closest date to today

我有一份XML文件,有几次音乐日。 在我的闪电/AS3号档案中,我只想显示与目前日期相对的即将到来的事件。

与此类似:

活动01:30-05-2010

活动02:02-06-2010

活动03:05-06-2010

今天是28-05-2010年,因此,我需要列出活动01。 2006年1月1日 我需要列出活动02。

我有关于将XML列入工作的基本AS3代码,但我有麻烦过滤结果。

Any ideas? Thanks.

问题回答

Construct Date,每个日期的物体,比较get(time) - ——它从1970年1月1日起的微秒。

我猜测这项工作:

var my_date:Date = new Date();
var dia:Date = new Date(my_date.fullYear,my_date.month,my_date.date);
//var dia:Date = new Date(2010,05,06);
var nowEvent1:Date = new Date(2010,04,30);
var nowEvent2:Date = new Date(2010,05,02);
var nowEvent3:Date = new Date(2010,05,05);
var nowEvent4:Date = new Date(2010,05,06);

var eventArray:Array = [nowEvent1,nowEvent2,nowEvent3,nowEvent4];

for (var i:int; i < eventArray.length; i++) {
    if (eventArray[i] >= dia) {
        trace(eventArray[i]);
        return;
    }
}

它只是一个带有硬编码价值的样本(因为XML法过于庞大),但似乎正在发挥作用。 改变“方言”变量后,即正确的即将到来的事件日期。

我在守则中,从PHP设计的闪电中抽出目前的日期,然后将其改为闪电中的一个目标。

如果有人感兴趣的话,我可以公布整个法典。 我也以更好的方式发言!





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

热门标签