juno.locale.time Module

Licence
See licence.txt for use and distribution terms.

abstract class Calendar;

Represents time in divisions such as weeks, months and years.

const int CurrentEra;

Represents the current era.

DateTime addMilliseconds(DateTime time, int value);

Returns a DateTime that is the specified number of milliseconds away from the specified DateTime.

Parameters
DateTime time
The DateTime to add to.
int value
The number of milliseconds to add.

DateTime addSeconds(DateTime time, int value);

Returns a DateTime that is the specified number of seconds away from the specified DateTime.

Parameters
DateTime time
The DateTime to add to.
int value
The number of seconds to add.

DateTime addMinutes(DateTime time, int value);

Returns a DateTime that is the specified number of minutes away from the specified DateTime.

Parameters
DateTime time
The DateTime to add to.
int value
The number of minutes to add.

DateTime addHours(DateTime time, int value);

Returns a DateTime that is the specified number of hours away from the specified DateTime.

Parameters
DateTime time
The DateTime to add to.
int value
The number of hours to add.

DateTime addDays(DateTime time, int value);

Returns a DateTime that is the specified number of days away from the specified DateTime.

Parameters
DateTime time
The DateTime to add to.
int value
The number of days to add.

DateTime addWeeks(DateTime time, int value);

Returns a DateTime that is the specified number of weeks away from the specified DateTime.

Parameters
DateTime time
The DateTime to add to.
int value
The number of weeks to add.

abstract DateTime addMonths(DateTime time, int value);

Returns a DateTime that is the specified number of months away from the specified DateTime.

Parameters
DateTime time
The DateTime to add to.
int value
The number of months to add.

abstract DateTime addYears(DateTime time, int value);

Returns a DateTime that is the specified number of years away from the specified DateTime.

Parameters
DateTime time
The DateTime to add to.
int value
The number of years to add.

abstract DayOfWeek getDayOfWeek(DateTime time);

Returns the day of the week in the specified DateTime.

Parameters
DateTime time
The DateTime to read.

abstract int getDayOfMonth(DateTime time);

Returns the day of the month in the specified DateTime.

Parameters
DateTime time
The DateTime to read.

abstract int getDayOfYear(DateTime time);

Returns the day of the year in the specified DateTime.

Parameters
DateTime time
The DateTime to read.

int getWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek);

Returns the week of the year in the specified DateTime.

Parameters
DateTime time
The DateTime to read.
CalendarWeekRule rule
A value that defines a calendar week.
DayOfWeek firstDayOfWeek
A value that represents the first day of the week.

int getHour(DateTime time);

Returns the hours value in the specified DateTime.

int getMinute(DateTime time);

Returns the minutes value in the specified DateTime.

int getSecond(DateTime time);

Returns the seconds value in the specified DateTime.

double getMilliseconds(DateTime time);

Returns the milliseconds value in the specified DateTime.

abstract int getEra(DateTime time);

Returns the era in the specified DateTime.

abstract int getYear(DateTime time);

Returns the year in the specified DateTime.

abstract int getMonth(DateTime time);

Returns the month in the specified DateTime.

abstract int getDaysInYear(int year, int era);
int getDaysInYear(int year);

Returns the number of days in the specified year and era.

abstract int getDaysInMonth(int year, int month, int era);
int getDaysInMonth(int year, int month);

Returns the number of days in the specified year, month and era.

abstract int getMonthsInYear(int year, int era);
int getMonthsInYear(int year);

Returns the number of months in the specified year and era.

int getLeapMonth(int year, int era);
int getLeapMonth(int year);

Returns the leap month for the specified year and era.

abstract bool isLeapDay(int year, int month, int day, int era);
bool isLeapDay(int year, int month, int day);

Determines whether a day is a leap day.

abstract bool isLeapMonth(int year, int month, int era);
bool isLeapMonth(int year, int month);

Determines whether a month is a leap month.

abstract bool isLeapYear(int year, int era);
bool isLeapYear(int year);

Determines whether a year is a leap year.

final bool isReadOnly();

Gets a value indicating whether the Calendar object is read-only.

class GregorianCalendar: juno.locale.time.Calendar;

Represents the Gregorian calendar.

const int ADEra;

Represents the current era.

this(GregorianCalendarType type = (GregorianCalendarType).Localized);



class JapaneseCalendar: juno.locale.time.Calendar;

Represents the Japanese calendar.

this();



class TaiwanCalendar: juno.locale.time.Calendar;

Represents the Taiwan calendar.

this();



class KoreanCalendar: juno.locale.time.Calendar;

Represents the Korean calendar.

this();



class ThaiBuddhistCalendar: juno.locale.time.Calendar;

Represents the Korean calendar.

this();



struct DateTime;

Represents an instant in time.

static DateTime min;

Represents the smallest possible DateTime value.

static DateTime max;

Represents the largest possible DateTime value.

static DateTime opCall(long ticks, DateTimeKind kind = cast(DateTimeKind)0);

Initializes a new instance.

static DateTime opCall(int year, int month, int day, DateTimeKind kind = cast(DateTimeKind)0);

Initializes a new instance.

static DateTime opCall(int year, int month, int day, int hour, int minute, int second, DateTimeKind kind = cast(DateTimeKind)0);

Initializes a new instance.

static DateTime opCall(int year, int month, int day, int hour, int minute, int second, int millisecond, DateTimeKind kind = cast(DateTimeKind)0);

Initializes a new instance.

DateTime add(TimeSpan value);
DateTime opAdd(TimeSpan value);
void opAddAssign(TimeSpan value);

Adds the specified TimeSpan to the value of this instance.

DateTime subtract(TimeSpan value);
DateTime opSub(TimeSpan value);
void opSubAssign(TimeSpan value);

Subtracts the specified number of ticks from the value of this instance.

DateTime addTicks(long value);

Adds the specified number of ticks to the value of this instance.

DateTime addMilliseconds(double value);

Adds the specfied number of milliseconds to the value of this instance.

Parameters
double value
A number of whole a fractional milliseconds.

DateTime addSeconds(double value);

Adds the specfied number of seconds to the value of this instance.

Parameters
double value
A number of whole a fractional seconds.

DateTime addMinutes(double value);

Adds the specfied number of minutes to the value of this instance.

Parameters
double value
A number of whole a fractional minutes.

DateTime addHours(double value);

Adds the specfied number of hours to the value of this instance.

Parameters
double value
A number of whole a fractional hours.

DateTime addDays(double value);

Adds the specfied number of days to the value of this instance.

Parameters
double value
A number of whole a fractional days.

DateTime addMonths(int value);

Adds the specified number of months to the value of this instance.

Parameters
int value
A number of months.

DateTime addYears(int value);

Adds the specified number of years to the value of this instance.

Parameters
int value
A number of years.

static DateTime parse(char[] s, IFormatProvider provider = cast(IFormatProvider)null);

Converts the specified string representation of a date and time to its DateTime equivalent.

Parameters
char[] s
A string containing a date and time to convert.
IFormatProvider provider
An object that supplies culture-specific information about s.

static DateTime parseExact(char[] s, char[] format, IFormatProvider provider = cast(IFormatProvider)null);

Converts the specified string representation of a date and time to its DateTime equivalent.

Parameters
char[] s
A string containing a date and time to convert.
char[] format
A format specifier that defines the required format of s.
IFormatProvider provider
An object that supplies culture-specific information about s.

static DateTime parseExact(char[] s, char[][] formats, IFormatProvider provider = cast(IFormatProvider)null);

Converts the specified string representation of a date and time to its DateTime equivalent.

Parameters
char[] s
A string containing a date and time to convert.
char[][] formats
An array of allowable formats of s.
IFormatProvider provider
An object that supplies culture-specific information about s.

static bool tryParse(char[] s, out DateTime result);

Converts the specified string representation of a date and time to its DateTime equivalent.

Parameters
char[] s
A string containing a date and time to convert.
DateTime result
The DateTime equivalent to the date and time specified in s.

static bool tryParse(char[] s, IFormatProvider provider, out DateTime result);

Converts the specified string representation of a date and time to its DateTime equivalent.

Parameters
char[] s
A string containing a date and time to convert.
IFormatProvider provider
An object that supplies culture-specific formatting information.
DateTime result
The DateTime equivalent to the date and time specified in s.

static bool tryParseExact(char[] s, char[] format, IFormatProvider provider, out DateTime result);

Converts the specified string representation of a date and time to its DateTime equivalent.

Parameters
char[] s
A string containing a date and time to convert.
char[] format
A format specifier that defines the required format of s.
IFormatProvider provider
An object that supplies culture-specific formatting information.
DateTime result
The DateTime equivalent to the date and time specified in s.

static bool tryParseExact(char[] s, char[][] formats, IFormatProvider provider, out DateTime result);

Converts the specified string representation of a date and time to its DateTime equivalent.

Parameters
char[] s
A string containing a date and time to convert.
char[][] formats
An array of allowable formats of s.
IFormatProvider provider
An object that supplies culture-specific formatting information.
DateTime result
The DateTime equivalent to the date and time specified in s.

char[] toString(char[] format, IFormatProvider provider);
char[] toString(char[] format);
char[] toString();

Converts the value of this instance to its equivalent string representation.

Parameters
char[] format
A DateTime format string.
IFormatProvider provider
An object that supplies culture-specific formatting information.

char[] toShortDateString();



char[] toLongDateString();



char[] toShortTimeString();



char[] toLongTimeString();



static int compare(DateTime d1, DateTime d2);

Compares two DateTime instances and returns in integer that determines whether the first is earlier than, the same as, or later than the second.

Parameters
DateTime d1
The first instance.
DateTime d2
The second instance.

int compareTo(DateTime other);
int opCmp(DateTime other);

Compares the value of this instance to a specified DateTime value and indicates whether this instance is earlier than, the same as, or later than the specified DateTime value.

Parameters
DateTime other
The instance to compare.

bool equals(DateTime other);
bool opEquals(DateTime other);

Indicates whether this instance is equal to the specified DateTime instance.

Parameters
DateTime other
The instance to compare to this instance.

DateTime toLocal();



DateTime toUtc();



int hour();

Gets the hour component.

int minute();

Gets the minute component.

int second();

Gets the seconds component.

int millisecond();

Gets the milliseconds component.

int day();

Gets the day of the month.

DayOfWeek dayOfWeek();

Gets the day of the week.

int dayOfYear();

Gets the day of the year.

int month();

Gets the month component.

int year();

Gets the year component.

DateTime date();

Gets the date component.

long ticks();

Gets the number of ticks that represent the date and time.

static int daysInMonth(int year, int month);

Gets the number of days in the specified month and year.

Parameters
int year
The year.
int month
The month.

static bool isLeapYear(int year);

Indicates whether the specified year is a leap year.

static DateTime now();

Gets a DateTime that is set to the current date and time, expressed as the local time.

static DateTime utcNow();

Gets a DateTime that is set to the current date and time, expressed as the Coordinated Universal Time (UTC).

static DateTime fromFileTime(long fileTime);

Converts the specified Windows file time to an equivalent local time.

Parameters
long fileTime
A Windows file time expressed in ticks.

static DateTime fromFileTimeUtc(long fileTime);

Converts the specified Windows file time to an equivalent UTC time.

Parameters
long fileTime
A Windows file time expressed in ticks.

long toFileTime();



long toFileTimeUtc();



static DateTime fromOleDate(double d);

Converts an OLE Automation date to a DateTime.

Parameters
double d
An OLE Automation date.

double toOleDate();

Converts the value of this instance to an OLE Automation date.