libperun

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

public static DateTime fromUnixTime(long unixTime);

Make a DateTime object from a unix timestamp.

Arguments
unixTimeNumber 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.

public bool opEquals(Object b);

Check if two DateTime objects represent the same point in time up to their supported precision.

public int opCompare(DateTime other);

Compare two DateTime objects. Returns -1 if the second object is larger, 0 if equal, 1 otherwise.

public TimeInterval opSub(DateTime b);

Return the difference between two DateTime objects, as a TimeInterval.

public String format(String fstr);

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.