Prev | Current Page 126 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

So, to initialize a
date with a birthday using the string method, you would do the following:
var birthDate : Date = Date.fromString(???1976-11-03 13:15:00???);
This time, the month value must start from 1, so would be the normal value for that month.
Using the fromTime method is a little less useful in that it requires you to pass the number of
milliseconds that have elapsed from the 1st of January 1970 to the date you wish to represent. This is
doubtful something you will be able to pull out of the air, but is a great tool when re - instantiating a
numerically serialized version of a date and time:
var birthDate : Date = Date.fromTime(215874900000);
Retrieving the Components of a Date
Once you have your date all nicely snug and warm in a Date object, the chances are you ??™ re going to
want to query certain components of that date. By component, it is meant a unit of time, such as the day
of the month or the month itself. haXe provides a list of functions for retrieving these details in a
numerical format.


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