Various tips related to the handling date and time in flex

1) Create the new date instance

var dateA:Date = new Date()

it will generate the current system date and stroe it in the dateA. It’s format is the long utc format.

2)DateField.stringToDate(value,format)

it will convert string (for ex: “2009/01/22”) to the date when u apply the format YYYY/MM/DD

3)DateField.dateToString(date,format)

it will convert date (for ex: 2009/01/22) to the date when u apply the format YYYY/MM/DD


4) Compare 2 dates:

ObjectUtil.dateCompare(a:date,b:date)

5) date.getTime():

this methode convert the date into the time instance and can be used to comparing the dates.


I was facing the problem in converting the string in format 2009-01-22 06:10:22 (YYYY-MM-DD HH:MM:SS) , do u know how to do this? I tried the normal way of DateField.dateToString and DateField.stringToDate , but it gives me the null result.

Got one component in Flex to format/parse the time in various format. You can view that component here





Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: