Class std.time.DateTime
Synopsis
public final class DateTime
Represents a point in time.
Fields
Constructors
protected DateTime(long sec,long nano);
No description given
Methods
Make a DateTime
object from a unix timestamp.
Arguments
unixTime | Number of seconds since the start of 1 January 1970 UTC. |
---|
Returns
A DateTime
object corresponding to that time.
public static DateTime now();
Get the current time.
Returns
A DateTime
object corresponding to the current time.
Check if two DateTime
objects represent the same point in time up to their
supported precision.
Compare two DateTime
objects. Returns -1 if the second object is larger, 0 if equal, 1 otherwise.
Return the difference between two DateTime
objects, as a TimeInterval
.
Return this date and time formatted as a string. The format is the same as with the C function
strftime()
.
public String format();
Return this date and time in a string format preferred by the current locale.