Time Attributes

A Time object contains several attributes to manipulate the different components of time, such as days and hours. The following table lists all Time's attributes and provides some examples:

Attribute Description
AD Field that indicates the calendar era indicating the common era (Anno Domini.).
Example:
	time as Time
	/*this will display 1 because 
	the current era is AD*/
	display time + "\n\n AD = " + time.AD
	
Attribute Description
am Boolean value which indicates whether the Time's period is between midnight to just before noon.
Example:
	time as Time
	time = '2004-12-25 02:45:00-03'
	//this will display true
	display time + "\n\n am = " + time.am
	time = '2004-12-25 20:45:00-03'
	display time + "\n\n am = " + time.am
	
Attribute Description
ampm Field that indicates the period of the day. If the period is am, it will return 0; otherwise, it will return 1.
Example:
	time as Time
	time = '2004-12-25 02:45:00-03'
	//this will display 0 
	display time + "\n\n ampm = " + time.ampm
	time = '2004-12-25 20:45:00-03'
	//this will display 1
	display time + "\n\n ampm = " + time.ampm
	
Attribute Description
BC Field that indicates the calendar era indicating the period before the common era (before Christ).
Example:
time as Time
	/*this will display 0 because 
	the current era is not BC*/
	display time + "\n\n BC = " + time.BC
	
Attribute Description
date String value containing the date formatted with the default mask.
Example:
time as Time
	time = '2004-12-25 20:45:00-03'
	//this will display Dec 25, 2004
	display time + "\n\n" + time.date
	
Attribute Description
day Int value representing the day component of the time.
Example:
	time as Time
	time = '2004-12-25 20:45:00-03'
	//it will display 25
	display time + "\n\n day: " + time.day
Attribute Description
dayOfMonth Int value representing the day part of the time.
Example:
time as Time
	time = '2004-12-25 20:45:00-03'
	//this will display 25
	display time + "\n\n day of month: " +
	time.day
Attribute Description
dayOfWeek Day of the week. Returns an integer from 1 to 7, where Sunday is 1.
Example:
time as Time
	time = '2004-12-25 20:45:00-03'
	display time + "\n\n day of the week: " +
	time.dayOfWeek
Attribute Description
days Returns the number of days elapsed since 00:00 January 1, 1970 GMT (UNIX epoch).
Example:
time as Time
	display "days since EPOCH: " + time.days
Attribute Description
EPOCH 1969-12-31 00:00:00-00. Base time from which milliseconds to calculate dates are counted.
Example:
//1969-12-31 00:00:00-00
	display "EPOCH: " + Time.EPOCH
Attribute Description
firstDayOfMonth Time value corresponding to the first day of the month.
Example:
time as Time
	//firstDayOfMonth is a Time object
	display "fist day of month: " + 
	time.firstDayOfMonth
	
Attribute Description
hour Int value representing the hour component of the date in the format h.
Example:
time as Time
	time = '2004-12-25 20:45:00-03' 
	display time + "\n\n hour: " + time.hour
Attribute Description
hourOfDay Int value representing the hour component of the date in the format hh.
Example:
time as Time
	time = '2004-12-25 20:45:00-03'
	display time + "\n\n hour of the day: " +
	time.hour
Attribute Description
hours Returns the number of hours elapsed since January 1, 1970 GMT.
Example:
time as Time
	display "hours passed since EPOCH: "+
	time.hours
Attribute Description
lastDayOfMonth Time value corresponding to the last day of the month.
Example:
time as Time
	//lastDayOfMonth is a Time object
	display "last day of month: " + 
	time.lastDayOfMonth
	
Attribute Description
locale This attribute is used to change the current locale. It is a write only attribute.
Example:
time as Time
	display "date fomatted with default locale: " +
	time.formatDate
	Time.locale = Java.Util.Locale.GERMAN
	display "date with German locale: " +
	time.formatDate
Attribute Description
maxvalue The maximum value a Time object can have.
Example:
	display "Time object's maximum value: "
	+ Time.maxvalue
Attribute Description
microSecond Int value representing the microseconds component of the date.
Example:
time as Time
	display time + "\n\n microseconds in time: " +
	time.microSecond
Attribute Description
microSeconds Returns the number of microseconds elapsed since January 1, 1970 GMT.
Example:
time as Time
	display "microseconds since EPOCH: " + 
	time.microDeconds
Attribute Description
milliSeconds Returns the number of milliseconds elapsed since January 1, 1970 GMT.
Example:
time as Time
	display "milliseconds since EPOCH: " +
	time.milliSeconds
Attribute Description
minute Int value representing the minutes component of the date.
Example:
time as Time
	time = '2004-12-25 20:45:00-03'
	display time + "\n\n minutes: " + time.minute
Attribute Description
minutes Returns the number of minutes elapsed since January 1, 1970 GMT.
Example:
time as Time
	display "minutes since EPOCH: " + time.minutes
Attribute Description
minvalue The minimum value a Time object can have.
Example:
time as Time
	display "Time object's minimum value: "
	+ time.minvalue
Attribute Description
month Int value representing the month component of the date.
Example:
time as Time
	time = '2004-12-25 20:45:00-03'
	display time + "\n\n month: " + 
	time.month
Attribute Description
second Int value representing the seconds component of the date.
Example:
time as Time
	time = '2004-12-25 20:45:10-03'
	display time + "\n\n seconds: " + time.second
Attribute Description
seconds Returns the number of seconds elapsed since January 1, 1970 GMT.
Example:
time as Time
	display "seconds since EPOCH: " + time.seconds
Attribute Description
timeOnlyHour Int value representing the hours component of the time, without calendar corrections.
Example:
time as Time
	display time + "\n\n" +
	"hours: " +
	time.timeOnlyHour
Attribute Description
timeOnlyMicroSecond Int value representing the microseconds component of the time, without calendar corrections.
Example:
time as Time
	display time + "\n\n" +
	"microseconds: "+
	time.timeOnlyMicroSecond
Attribute Description
timeOnlyMinute Int value representing the minutes component of the time, without calendar corrections.
Example:
time as Time
	display time + "\n\n"+
	"minutes: " +
	time.timeOnlyMinute
Attribute Description
timeOnlySecond Int value representing the seconds component of the time, without calendar corrections.
Example:
time as Time
	display time + "\n\n"+
	"seconds: " +
	time.timeOnlySecond
Attribute Description
time String value containing the time of the day formatted with the default mask.
Example:
time as Time
	display "time formatted with default mask:" +
	time.date
Attribute Description
timeZone Time according to the locale.
Example:
time as Time
	Time.timeZone = TimeZone.getTimeZone("GMT-3")
	display "GMT-3: " + time
	Time.timeZone = TimeZone.getTimeZone("GMT-8")
	display "GMT-8: " + time
Attribute Description
weekOfMonth Int value indicating the week number within the current month, starting from 1.
Example:
time as Time
	time = '2004-01-01 20:45:00-03'
	display time + "\n\n week of month: " +
	time.weekOfMonth
	time = '2004-01-07 20:45:00-03'
	display time + "\n\n week of month: " + 
	time.weekOfMonth
	
Attribute Description
weekOfYear Int value indicating the week number within the current year, starting from 1.
Example:
time as Time
	time = '2004-01-07 20:45:00-03'
	display time + "\n\n week of year: " +
	time.weekOfYear
	time = '2004-02-07 20:45:00-03'
	display time + "\n\n week of year: " +
	time.weekOfYear