Recipe 14.2. Retrieving the Date Values


Problem

You want to retrieve the year, month, day of month, day of week, hour, minute, second, or millisecond value from a Date object.

Solution

Use the fullYear, date, month, day, hours, minutes, seconds, or milliseconds properties.

Discussion

The fullYear, date, month, day, hours, minutes, seconds, and milliseconds properties return the values from a Date object:

  • The fullYear property specifies the year as a four-digit value, such as 2010.

  • The date property specifies the day of the month as a value from 1 to 31.

  • The month property specifies the month as an integer from 0 (January) to 11 (December).

  • The day property specifies the day of the week as an integer from 0 (Sunday) to 6 (Saturday).

  • The hours property returns the hours value as an integer from 0 (midnight) to 23 (11 p.m.).

  • The minutes and seconds properties return values from 0 to 59.

  • The milliseconds property returns a value from 0 to 999.

Each of these properties has a UTC (Coordinated Universal Time, also known as Greenwich Mean Time) correspondent. For example, although the hours property returns the current hours value based on the client computer's clock, the hoursUTC property returns the current hours value in UTC time.




ActionScript 3. 0 Cookbook
ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers
ISBN: 0596526954
EAN: 2147483647
Year: 2007
Pages: 351

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net