. .
getSeconds() : Int Returns the number of seconds; 0??“59
Chapter 3: Learning the Basics
51
Date Method Descriptions
getTime() : Float Returns the number of milliseconds since 1st Jan 1970
toString() : String Returns a string representation of the Date object
static fromString
( s : String ) : Date
Instantiates a Date object from a string representation of a
date.
static fromTime
( t : Float ) : Date
Instantiates a Date object from an integer depicting the number
of milliseconds since 1st Jan 1970
static now() : Date Instantiates a Date object using the current date and time
Creating a Date Object
The primary class used for working with dates is the Date class. Like Arrays, this class needs to be
instantiated before you can use it. However, this instantiation is a little longer than Array instantiation as
it expects a whole number of parameters. The definition for instantiating a Date object looks like this:
var year : Int = 2007;
var month : Int = 9;
var day : Int = 13;
var hours : Int = 23;
var mins : Int = 39;
var secs : Int = 30;
var date = new Date( year, month, day, hours, mins, secs );
Long, huh? The instantiation requires all the parameters to be set, including the time, though if it ??™ s only
the date you ??™ re after, you can supply a zero for each of the time related parameters.
Pages:
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136