Gethours (Date.gethours Method) - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

Returns
- An integer representing the year.
Number
Example
The following example uses the constructor to create a Date object. The trace statement
shows the value returned by the
var my_date:Date = new Date();
trace(my_date.getYear()); // displays 104
trace(my_date.getFullYear()); // displays current year

getHours (Date.getHours method)

public getHours() : Number
Returns the hour (an integer from 0 to 23) of the specified Date object, according to local
time. Local time is determined by the operating system on which Flash Player is running.
Availability: ActionScript 1.0; Flash Lite 2.0
Returns
- An integer.
Number
Example
The following example uses the constructor to create a Date object based on the current time
and uses the
getHours()
var my_date:Date = new Date();
trace(my_date.getHours());
var my_date:Date = new Date();
var hourObj:Object = getHoursAmPm(my_date.getHours());
trace(hourObj.hours);
trace(hourObj.ampm);
function getHoursAmPm(hour24:Number):Object {
var returnObj:Object = new Object();
returnObj.ampm = (hour24<12) ? "AM" : "PM";
var hour12:Number = hour24%12;
if (hour12 == 0) {
hour12 = 12;
}
returnObj.hours = hour12;
return returnObj;
}
getFullYear()
method to display hour values from that object:
method.
Date
333

Advertisement

Table of Contents
loading

Table of Contents