Sinespace Client  2023.2.17543
Client-side scripting for Sinespace
SineSpace.Scripting.Types.SDateTime Class Reference
Inheritance diagram for SineSpace.Scripting.Types.SDateTime:

Public Member Functions

 SDateTime ()
 Creates a new SDateTime object. More...
 
 SDateTime (DateTime dateTime)
 Creates a new SDateTime object from a DateTime object. More...
 
 SDateTime (int? Year=null, int? Month=null, int? Day=null, int? Hour=null, int? Minute=null, int? Second=null, int? Millisecond=null)
 Creates a new SDateTime object by assigning values to each time unit. Time unit will be current time if not be assigned. SDateTime will be current time if cannot be created. More...
 
bool Equals (SDateTime other)
 Returns true if the datetimes are same. More...
 
int ComparesTo (SDateTime other)
 Compares two datetimes and returns an integer. 0 == identical. greater than 0 == This datetime is greater than other. less than 0 == This datetime is less than other. More...
 
string FormatLocal (string format)
 Outputs a custom formatted string with the date and time according to local language rules. More...
 
string FormatGlobal (string format)
 Outputs a custom formatted string with the date and time according to global rules (culture invariant). More...
 
string Regional (string region)
 Outputs a string with the date and time formatted according to specific regional rules. More...
 
string FormatRegional (string region, string format)
 Outputs a custom formatted string with the date and time according to specific regional rules. More...
 
SDateTime AddYears (int amount)
 Return a new SDateTime that is the current date time + amount years. More...
 
SDateTime AddMonths (int amount)
 Return a new SDateTime that is the current date time + amount months. More...
 
SDateTime AddDays (double amount)
 Return a new SDateTime that is the current date time + amount days. More...
 
SDateTime AddHours (double amount)
 Return a new SDateTime that is the current date time + amount hours. More...
 
SDateTime AddMinutes (double amount)
 Return a new SDateTime that is the current date time + amount minutes. More...
 
SDateTime AddSeconds (double amount)
 Return a new SDateTime that is the current date time + amount seconds. More...
 
SDateTime AddMilliseconds (double amount)
 Return a new SDateTime that is the current date time + amount milliseconds. More...
 

Static Public Member Functions

static SDateTime Now ()
 Creates a new SDateTime object equal to the current local time. More...
 
static SDateTime Server ()
 Creates a new SDateTime object equal to the current server time. More...
 
static SDateTime Parse (string input)
 Creates a new SDateTime object by attempting to parse a string input. Returns null/nil if the string cannot be parsed. More...
 
static bool IsLeapYear (int year)
 Return true if the specified year is a leap year. More...
 
static int DaysInMonth (int year, int month)
 Return the number of days in the given month for the given year. More...
 

Properties

int Year [get]
 Get the independent time unit property of the SDateTime object. More...
 
int Month [get]
 
int Day [get]
 
int Hour [get]
 
int Minute [get]
 
int Second [get]
 
int Millisecond [get]
 
string Local [get]
 Outputs a string with the date and time formatted according to local language rules. More...
 
string Global [get]
 Outputs a string with the date and time formatted according to global rules (culture invariant). More...
 
int UnixTime [get]
 Return this time in Unix time, the number of seconds since Jan 1st, 1970. More...
 
bool IsDaylightSavingTime [get]
 Indicates whether this instance of DateTime is within the daylight saving time range for the current time zone. More...
 

Constructor & Destructor Documentation

◆ SDateTime() [1/3]

SineSpace.Scripting.Types.SDateTime.SDateTime ( )

Creates a new SDateTime object.

◆ SDateTime() [2/3]

SineSpace.Scripting.Types.SDateTime.SDateTime ( DateTime  dateTime)

Creates a new SDateTime object from a DateTime object.

Parameters
dateTime

◆ SDateTime() [3/3]

SineSpace.Scripting.Types.SDateTime.SDateTime ( int?  Year = null,
int?  Month = null,
int?  Day = null,
int?  Hour = null,
int?  Minute = null,
int?  Second = null,
int?  Millisecond = null 
)

Creates a new SDateTime object by assigning values to each time unit. Time unit will be current time if not be assigned. SDateTime will be current time if cannot be created.

Member Function Documentation

◆ AddDays()

SDateTime SineSpace.Scripting.Types.SDateTime.AddDays ( double  amount)

Return a new SDateTime that is the current date time + amount days.

Parameters
amount

◆ AddHours()

SDateTime SineSpace.Scripting.Types.SDateTime.AddHours ( double  amount)

Return a new SDateTime that is the current date time + amount hours.

Parameters
amount

◆ AddMilliseconds()

SDateTime SineSpace.Scripting.Types.SDateTime.AddMilliseconds ( double  amount)

Return a new SDateTime that is the current date time + amount milliseconds.

Parameters
amount

◆ AddMinutes()

SDateTime SineSpace.Scripting.Types.SDateTime.AddMinutes ( double  amount)

Return a new SDateTime that is the current date time + amount minutes.

Parameters
amount

◆ AddMonths()

SDateTime SineSpace.Scripting.Types.SDateTime.AddMonths ( int  amount)

Return a new SDateTime that is the current date time + amount months.

Parameters
amount

◆ AddSeconds()

SDateTime SineSpace.Scripting.Types.SDateTime.AddSeconds ( double  amount)

Return a new SDateTime that is the current date time + amount seconds.

Parameters
amount

◆ AddYears()

SDateTime SineSpace.Scripting.Types.SDateTime.AddYears ( int  amount)

Return a new SDateTime that is the current date time + amount years.

Parameters
amount

◆ ComparesTo()

int SineSpace.Scripting.Types.SDateTime.ComparesTo ( SDateTime  other)

Compares two datetimes and returns an integer. 0 == identical. greater than 0 == This datetime is greater than other. less than 0 == This datetime is less than other.

Parameters
otherAnother datetime you want to compare

◆ DaysInMonth()

static int SineSpace.Scripting.Types.SDateTime.DaysInMonth ( int  year,
int  month 
)
static

Return the number of days in the given month for the given year.

Parameters
year
month

◆ Equals()

bool SineSpace.Scripting.Types.SDateTime.Equals ( SDateTime  other)

Returns true if the datetimes are same.

Parameters
otherAnother datetime you want to compare

◆ FormatGlobal()

string SineSpace.Scripting.Types.SDateTime.FormatGlobal ( string  format)

Outputs a custom formatted string with the date and time according to global rules (culture invariant).

Parameters
formatA string indicating the desired output format.
– Output the current time with global (always consistent) formatting.
Space.Log(DateTime.Now.FormatGlobal("d t"))
– Outputs the current date followed by time.

◆ FormatLocal()

string SineSpace.Scripting.Types.SDateTime.FormatLocal ( string  format)

Outputs a custom formatted string with the date and time according to local language rules.

Parameters
formatA string indicating the desired output format.
– Output the current time with global (always consistent) formatting.
Space.Log(DateTime.Now.FormatLocal("d t"))
– Outputs the current date followed by time.

◆ FormatRegional()

string SineSpace.Scripting.Types.SDateTime.FormatRegional ( string  region,
string  format 
)

Outputs a custom formatted string with the date and time according to specific regional rules.

Parameters
formatA string indicating the desired output format.
– Output the current time with specific regional formatting.
Space.Log(DateTime.Now.FormatRegional("en-US", "d t"))
– Outputs the current date followed by time.

◆ IsLeapYear()

static bool SineSpace.Scripting.Types.SDateTime.IsLeapYear ( int  year)
static

Return true if the specified year is a leap year.

Parameters
year

◆ Now()

static SDateTime SineSpace.Scripting.Types.SDateTime.Now ( )
static

Creates a new SDateTime object equal to the current local time.

– Output the current time with localized formatting.
Space.Log(DateTime.Now.Local)

◆ Parse()

static SDateTime SineSpace.Scripting.Types.SDateTime.Parse ( string  input)
static

Creates a new SDateTime object by attempting to parse a string input. Returns null/nil if the string cannot be parsed.

Parameters
inputThe string to parse into a date.

◆ Regional()

string SineSpace.Scripting.Types.SDateTime.Regional ( string  region)

Outputs a string with the date and time formatted according to specific regional rules.

Parameters
regionThe region to put the date time in, such as en-US.
– Output the current time with specific regional formatting.
Space.Log(DateTime.Now.Regional("en-US"))

◆ Server()

static SDateTime SineSpace.Scripting.Types.SDateTime.Server ( )
static

Creates a new SDateTime object equal to the current server time.

– Output the current server time with localized formatting.
Space.Log(DateTime.Server.Local)

Property Documentation

◆ Day

int SineSpace.Scripting.Types.SDateTime.Day
get

◆ Global

string SineSpace.Scripting.Types.SDateTime.Global
get

Outputs a string with the date and time formatted according to global rules (culture invariant).

– Output the current time with global (always consistent) formatting.
Space.Log(DateTime.Now.Global)

◆ Hour

int SineSpace.Scripting.Types.SDateTime.Hour
get

◆ IsDaylightSavingTime

bool SineSpace.Scripting.Types.SDateTime.IsDaylightSavingTime
get

Indicates whether this instance of DateTime is within the daylight saving time range for the current time zone.

◆ Local

string SineSpace.Scripting.Types.SDateTime.Local
get

Outputs a string with the date and time formatted according to local language rules.

– Output the current time with localized formatting.
– The exact structure of the output will vary depending on the language of the user.
Space.Log(DateTime.Now.Local)

◆ Millisecond

int SineSpace.Scripting.Types.SDateTime.Millisecond
get

◆ Minute

int SineSpace.Scripting.Types.SDateTime.Minute
get

◆ Month

int SineSpace.Scripting.Types.SDateTime.Month
get

◆ Second

int SineSpace.Scripting.Types.SDateTime.Second
get

◆ UnixTime

int SineSpace.Scripting.Types.SDateTime.UnixTime
get

Return this time in Unix time, the number of seconds since Jan 1st, 1970.

◆ Year

int SineSpace.Scripting.Types.SDateTime.Year
get

Get the independent time unit property of the SDateTime object.