Represent a data time in Gregorian calendar.
Parent Class
| Type | Name | Signature |
|---|---|---|
| constructor | DateTime | public DateTime(int, int, int, int, int, int, int) |
| method | diff | public int diff(System.DateTime) |
| method | format | public String format(string) |
| method | getDay | public int getDay() |
| method | getHour | public int getHour() |
| method | getMilli | public int getMilli() |
| method | getMinute | public int getMinute() |
| method | getMonth | public int getMonth() |
| method S | getNow | public static DateTime getNow() |
| method | getPart | public int getPart(System.DateTimePart) |
| method | getSecond | public int getSecond() |
| method | getYear | public int getYear() |
| method | toString | public String toString() |
public DateTime(int year, int month, int day, int hour, int minute, int second, int milli)Create a datatime from each specified part.
Parameters
public int diff(DateTime another)Return the difference in milliseconds (this - another)
Parameters
Returns
public String format(string fmt)Convert the DateTime to a string with a format string, which may use the following characters as a placeholder for the corresponding data time part:
y: (up to 4 digits) Year
M: (up to 2 digits) Month in year (1 - 12)
d: (up to 2 digits) Day in month (1 - 31)
H: (up to 2 digits) Hour in day (0 - 23)
m: (up to 2 digits) Minute in hour (0 - 59)
s: (up to 2 digits) Second in minute (0 - 59)
S: (up to 3 digits) Millisecond in second (000 - 999)
Other characters are rendered literally.
Parameters
Returns
public int getDay()Get day. Note this value is 1-based, within the range of [1, 31].
Returns
public int getHour()Get hour.
Returns
public int getMilli()Get millisecond.
Returns
public int getMinute()Get minute.
Returns
public int getMonth()Get month. Note this value is 1-based, within the range of [1, 12].
Returns
public static DateTime getNow()Get the current local time.
Required Policies
System.Environment/readReturns
public int getPart(DateTimePart part)Get the value of a specified part from this datetime.
Parameters
Returns
public int getSecond()Get second.
Returns
public int getYear()Get year.
Returns
public String toString()Convert the time to a default form (yyyy/MM/dd-hh:mm:ss.SSS).
Returns
yyyy/MM/dd-hh:mm:ss.SSS.