Prev | Current Page 128 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The getFullYear method returns the year as
it is written, so for this birthday, it would return 1976. It is named thus to emphasize that the method
returns a full four - digit representation of the year:
var month : Int = birthDate.getMonth(); // 0 = January, 1 = February ...
var year : Int = birthDate.getFullYear(); // 1976 etc.
Chapter 3: Learning the Basics
53
haXe provides you with the functions getHours , getMinutes , and getSeconds for retrieving the time
components of a Date object as integer values. The returned values represent the time components, as
they would be written on a 24 - hour digital clock:
var hours : Int = birthDate.getHours(); // 0 ... 23
var mins : Int = birthDate.getMinutes(); // 0 ... 59
var secs : Int = birthDate.getSeconds(); // 0 ... 59
The last method provided by the Date object is the getTime method. getTime returns the number of
milliseconds elapsed since the 1st of January, 1970, which is the exact data required by the Date objects
fromTime method:
var time : Float = birthDate.


Pages:
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140