Reference for the Mosaic class Core::Time

Core::Time
CurrentTime
Day
DayOfWeek
DayOfYear
Hour
Minute
Month
Second
String
Time
WeekOfYear
Year
Add()
Difference()
Format()
Initialize()
Initialize2()
Subtract()

The class Core::Time is used for date and time operations. Objects of this class can store the time, convert it and format strings with the time, etc.

method Core::Time Add
(
arg Core::TimeSpan aTimeSpan
);

The method Add() calculates a new time value by an addition of the aTimeSpan to this time object. The method creates a new Core::Time object and initializes it with the new time and date value.

property Core::Time CurrentTime;

The property 'CurrentTime' stores the current time. This property is read only - it is not possible to assign a value to it.

property int32 Day;

The property 'Day' stores the day in range 1 .. 31.

property int32 DayOfWeek;

The property 'DayOfWeek' contains the day of the week as a number in the range 0 .. 6. The value 0 corresponds to Sunday, 1 to Monday, etc. This property is read only - it is not possible to assign a value to it.

property int32 DayOfYear;

The property 'DayOfYear' contains the day of the year as a number in the range 1 .. 366. This property is read only - it is not possible to assign a value to it.

method Core::TimeSpan Difference
(
arg Core::Time aTime
);

The method Difference() calculates a delta value between this time object and the object passed in the parameter aTime. The method creates and initializes a new Core::TimeSpan object with the calculated difference.

method string Format
(
arg string aFormat
);

The method Format() converts the stored date and time accordingly to the supplied aFormat parameter in a string. The aFormat parameter consists of format codes, preceded by the percent sign '%'. At the runtime the codes are replaced with their corresponding content. All other signs that do not begin with % are simply taken over from aFormat to the output string. Following codes are available:

To remove the leading zeros, the '#' sign may prefix the following format code. For example '%#m' will format the month as a decimal number in the range 1-12. In contrast to it, '%m' formats the number with the leading zero sign 01-12.

The month and weekday names are stored in constants within the unit Resources. To adapt them to a new language, you can create variants of these constants.

property int32 Hour;

The property 'Hour' stores the number of hours since midnight.

method Core::Time Initialize
(
arg uint32 aTime
);

The method Initialize() initializes this Core::Time object with the given time as number of seconds since 1.1.1970 and returns this object.

method Core::Time Initialize2
(
arg int32 aYear,
arg int32 aMonth,
arg int32 aDay,
arg int32 aHour,
arg int32 aMinute,
arg int32 aSecond
);

The method Initialize2() initializes this Core::Time object with the given time and date and returns this object.

property int32 Minute;

The property 'Minute' stores the number of minutes.

property int32 Month;

The property 'Month' stores the month in range 1 .. 12.

property int32 Second;

The property 'Second' stores the number of seconds.

property string String;

The property 'String' stores the time as a string: "YYYY-MM-DD hh:mm:ss". This property is read only - it is not possible to assign a value to it.

method Core::Time Subtract
(
arg Core::TimeSpan aTimeSpan
);

The method Subtract() calculates a new time value by a subtraction of the aTimeSpan from this time object. The method creates a new Core::Time object and initializes it with the new time and date value.

property uint32 Time;

The property 'Time' stores the time as the number of seconds since 1.1.1970. The Core::Time object converts the given seconds in year, month, day, hour, etc.

property int32 WeekOfYear;

The property 'WeekOfYear' contains the week of the year as a number in the range 0 .. 53. Each week starts with Monday. This property is read only - it is not possible to assign a value to it.

property int32 Year;

The property 'Year' stores the year including the century.