C# OJAI Client API
MapRDB.Driver.Ojai.OjaiTimestamp Class Reference

Public Member Functions

 OjaiTimestamp (long millisSinceEpoch)
 Constructor of OjaiTimestamp instance from the milliseconds value since the Unix epoch. More...
 
 OjaiTimestamp (int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
 Constructor of OjaiTimestamp instance set to the specified fields in the default time zone. More...
 
 OjaiTimestamp (DateTime dateTime)
 Constructor of OjaiTimestamp instance from a DateTime. More...
 
long GetMillisSinceEpoch ()
 The total number of milliseconds since the Unix epoch. More...
 
DateTime ToDateTime ()
 Returns this OJAI timestamp as DateTime instance. More...
 
String ToUTCString ()
 Returns the ISO8601 format timestamp string in UTC. More...
 
String ToLocalString ()
 Returns the ISO8601 format timestamp string in local time zone. More...
 
String ToString (String pattern)
 Returns the string representation the timestamp using the specified format pattern. More...
 
override String ToString ()
 
override int GetHashCode ()
 
override bool Equals (Object obj)
 

Static Public Member Functions

static OjaiTimestamp Parse (String dateTimeStr)
 Parses and returns an instance of OjaiTimestamp from the specified string. More...
 

Public Attributes

int Year => _dateTime.Year
 Number of years of OJAI timestamp. More...
 
int Month => _dateTime.Month
 Number of months of OJAI timestamp. More...
 
int Day => _dateTime.Day
 Number of days of OJAI timestamp. More...
 
int Hour => _dateTime.Hour
 Number of hours of OJAI timestamp. More...
 
int Minute => _dateTime.Minute
 Number of minutes of OJAI timestamp. More...
 
int Second => _dateTime.Second
 Number of seconds of OJAI timestamp. More...
 
int Millisecond => _dateTime.Millisecond
 Number of milliseconds of OJAI timestamp. More...
 

Private Attributes

DateTime _dateTime
 
long _millisSinceEpoch
 

Static Private Attributes

static DateTime EPOCH_DATE = new DateTime(1970, 1, 1, 0, 0, 0, 0)
 

Constructor & Destructor Documentation

◆ OjaiTimestamp() [1/3]

MapRDB.Driver.Ojai.OjaiTimestamp.OjaiTimestamp ( long  millisSinceEpoch)

Constructor of OjaiTimestamp instance from the milliseconds value since the Unix epoch.

Parameters
millisSinceEpochthe milliseconds from 1970-01-01T00:00:00.000 UTC

◆ OjaiTimestamp() [2/3]

MapRDB.Driver.Ojai.OjaiTimestamp.OjaiTimestamp ( int  year,
int  monthOfYear,
int  dayOfMonth,
int  hourOfDay,
int  minuteOfHour,
int  secondOfMinute,
int  millisOfSecond 
)

Constructor of OjaiTimestamp instance set to the specified fields in the default time zone.

Parameters
yearthe year
monthOfYearthe month of the year, from 1 to 12
dayOfMonththe day of the month, from 1 to 31
hourOfDaythe hour of the day, from 0 to 23
minuteOfHourthe minute of the hour, from 0 to 59
secondOfMinutethe second of the minute, from 0 to 59
millisOfSecondthe millisecond of the second, from 0 to 999

◆ OjaiTimestamp() [3/3]

MapRDB.Driver.Ojai.OjaiTimestamp.OjaiTimestamp ( DateTime  dateTime)

Constructor of OjaiTimestamp instance from a DateTime.

Parameters
dateTime

Member Function Documentation

◆ GetMillisSinceEpoch()

long MapRDB.Driver.Ojai.OjaiTimestamp.GetMillisSinceEpoch ( )

The total number of milliseconds since the Unix epoch.

◆ Parse()

static OjaiTimestamp MapRDB.Driver.Ojai.OjaiTimestamp.Parse ( String  dateTimeStr)
static

Parses and returns an instance of OjaiTimestamp from the specified string.

Parameters
dateTimeStr

◆ ToDateTime()

DateTime MapRDB.Driver.Ojai.OjaiTimestamp.ToDateTime ( )

Returns this OJAI timestamp as DateTime instance.

◆ ToLocalString()

String MapRDB.Driver.Ojai.OjaiTimestamp.ToLocalString ( )

Returns the ISO8601 format timestamp string in local time zone.

◆ ToString()

String MapRDB.Driver.Ojai.OjaiTimestamp.ToString ( String  pattern)

Returns the string representation the timestamp using the specified format pattern.

Parameters
patternthe pattern specification

◆ ToUTCString()

String MapRDB.Driver.Ojai.OjaiTimestamp.ToUTCString ( )

Returns the ISO8601 format timestamp string in UTC.

Member Data Documentation

◆ Day

int MapRDB.Driver.Ojai.OjaiTimestamp.Day => _dateTime.Day

Number of days of OJAI timestamp.

◆ Hour

int MapRDB.Driver.Ojai.OjaiTimestamp.Hour => _dateTime.Hour

Number of hours of OJAI timestamp.

◆ Millisecond

int MapRDB.Driver.Ojai.OjaiTimestamp.Millisecond => _dateTime.Millisecond

Number of milliseconds of OJAI timestamp.

◆ Minute

int MapRDB.Driver.Ojai.OjaiTimestamp.Minute => _dateTime.Minute

Number of minutes of OJAI timestamp.

◆ Month

int MapRDB.Driver.Ojai.OjaiTimestamp.Month => _dateTime.Month

Number of months of OJAI timestamp.

◆ Second

int MapRDB.Driver.Ojai.OjaiTimestamp.Second => _dateTime.Second

Number of seconds of OJAI timestamp.

◆ Year

int MapRDB.Driver.Ojai.OjaiTimestamp.Year => _dateTime.Year

Number of years of OJAI timestamp.