DateTime
Overview
DateTime type used to store and work with date/time values.
Location
-
Reference:
- Elements.dll .NET, .NET Core 6.0, .NET Standard 2.0
- elements.jar Cooper
- Elements.fx Island, ToffeeV2
- libElements.fx Toffee
- Namespace: RemObjects.Elements.RTL
- Platforms: .NET, .NET Core 6.0, .NET Standard 2.0, Cooper, Island, Toffee, ToffeeV2
-
Mapped to:
- Calendar Cooper
- NSDate Toffee, ToffeeV2
constructor .NET, .NET Core 6.0, .NET Standard 2.0
constructor
DateTime()
init()
Sub New()
constructor (Int64)
Creates a new object with a given number of ticks.
constructor(aTicks: Int64)
DateTime(Int64 aTicks)
init(_ aTicks: Int64)
DateTime(Int64 aTicks)
Sub New(aTicks As Int64)
Parameters:
- aTicks:
Creates a new object with a given date.
Parameters:
- aYear:
- aMonth:
- aDay:
Creates a new object with a given date.
Parameters:
- aYear:
- aMonth:
- aDay:
- anHour:
- aMinute:
Creates a new object with a given date.
constructor(aYear: Int32; aMonth: Int32; aDay: Int32; anHour: Int32; aMinute: Int32; aSecond: Int32)
init(_ aYear: Int32, _ aMonth: Int32, _ aDay: Int32, _ anHour: Int32, _ aMinute: Int32, _ aSecond: Int32)
Parameters:
- aYear:
- aMonth:
- aDay:
- anHour:
- aMinute:
- aSecond:
constructor(aYear: Int32; aMonth: Int32; aDay: Int32; anHour: Int32; aMinute: Int32; aSecond: Int32; aMSec: Int32)
DateTime(Int32 aYear, Int32 aMonth, Int32 aDay, Int32 anHour, Int32 aMinute, Int32 aSecond, Int32 aMSec)
init(_ aYear: Int32, _ aMonth: Int32, _ aDay: Int32, _ anHour: Int32, _ aMinute: Int32, _ aSecond: Int32, _ aMSec: Int32)
Parameters:
- aYear:
- aMonth:
- aDay:
- anHour:
- aMinute:
- aSecond:
- aMSec:
Add
Add a timespan to a date, and returning the new date.
Parameters:
- Value:
AddDays
Adds a nr of days and returns a new datetime.
Parameters:
- Value:
AddHours
Adds a nr of hours and returns a new datetime.
Parameters:
- Value:
AddMilliSeconds
Adds a nr of msec and returns a new datetime.
Parameters:
- Value:
AddMinutes
Adds a nr of minutes and returns a new datetime.
Parameters:
- Value:
AddMonths
Adds a nr of months and returns a new datetime.
Parameters:
- Value:
AddSeconds
Adds a nr of seconds and returns a new datetime.
Parameters:
- Value:
AddYears
Adds a nr of years and returns a new datetime.
Parameters:
- Value:
Compare
Compares two dates, and returns 0 if the same, -1 if less, 1 if more.
Parameters:
- Value1:
- Value2:
Parameters:
- other:
Compares this date, and returns 0 if the same, -1 if less, 1 if more.
Parameters:
- Value:
Date
Returns the date without time part.
property Date: DateTime read;
DateTime Date { get; }
var Date: DateTime { get{} }
DateTime Date { __get; }
ReadOnly Property Date() As DateTime
Day
Returns the day of the month (1..31)
property Day: Int32 read;
Int32 Day { get; }
var Day: Int32 { get{} }
Integer Day { __get; }
ReadOnly Property Day() As Int32
DayOfWeek
Returns the day of the week (1..7)
property DayOfWeek: Int32 read;
Int32 DayOfWeek { get; }
var DayOfWeek: Int32 { get{} }
Integer DayOfWeek { __get; }
ReadOnly Property DayOfWeek() As Int32
FromOADate
Converts an OLE date to a DateTime
Parameters:
- aOADate:
FromUnixDate
Parameters:
- aUnixDate:
Hour
Returns the hour (0..23)
property Hour: Int32 read;
Int32 Hour { get; }
var Hour: Int32 { get{} }
Integer Hour { __get; }
ReadOnly Property Hour() As Int32
IsUTC
property IsUTC: Boolean read;
Boolean IsUTC { get; }
var IsUTC: Boolean { get{} }
Boolean IsUTC { __get; }
ReadOnly Property IsUTC() As Boolean
Millisecond .NET, .NET Core 6.0, .NET Standard 2.0, Island, Toffee, ToffeeV2
property Millisecond: Int32 read;
Int32 Millisecond { get; }
var Millisecond: Int32 { get{} }
ReadOnly Property Millisecond() As Int32
Minute
Returns the minutes in this datetime.
property Minute: Int32 read;
Int32 Minute { get; }
var Minute: Int32 { get{} }
Integer Minute { __get; }
ReadOnly Property Minute() As Int32
Month
Returns the month in this datetime.
property Month: Int32 read;
Int32 Month { get; }
var Month: Int32 { get{} }
Integer Month { __get; }
ReadOnly Property Month() As Int32
OffsetToUTC
property OffsetToUTC: Int32 read;
Int32 OffsetToUTC { get; }
var OffsetToUTC: Int32 { get{} }
Integer OffsetToUTC { __get; }
ReadOnly Property OffsetToUTC() As Int32
Second
Returns the seconds in this datetime.
property Second: Int32 read;
Int32 Second { get; }
var Second: Int32 { get{} }
Integer Second { __get; }
ReadOnly Property Second() As Int32
Ticks
Returns the nr of ticks, there are 10 000 000 ticks in a second.
property Ticks: Int64 read;
Int64 Ticks { get; }
var Ticks: Int64 { get{} }
Int64 Ticks { __get; }
ReadOnly Property Ticks() As Int64
TicksTill1970
const TicksTill1970: Int64 = 621355968000000000;
const Int64 TicksTill1970 = 621355968000000000
static let TicksTill1970: Int64 = 621355968000000000
static final Int64 TicksTill1970 = 621355968000000000
Dim TicksTill1970 As Int64 = 621355968000000000
Returns the time passed since a given datetime compared to the current one.
Parameters:
- aOtherDateTime:
TimeSince
Returns the time passed since a given datetime compared to now.
property TimeSince: TimeSpan read;
TimeSpan TimeSince { get; }
var TimeSince: TimeSpan { get{} }
TimeSpan TimeSince { __get; }
ReadOnly Property TimeSince() As TimeSpan
Today
Returns the current date without time part.
class property Today: not nullable DateTime read;
class DateTime! Today { get; }
static var Today: DateTime { get{} }
class DateTime Today { __get; }
Shared ReadOnly Property Today() As DateTime
ToISO8601String
method ToISO8601String(aFormat: ISO8601Format; aTimeZone: TimeZone): not nullable String
String! ToISO8601String(ISO8601Format aFormat, TimeZone aTimeZone)
func ToISO8601String(_ aFormat: ISO8601Format, _ aTimeZone: TimeZone) -> String
String ToISO8601String(ISO8601Format aFormat, TimeZone aTimeZone)
Function ToISO8601String(aFormat As ISO8601Format, aTimeZone As TimeZone) As String
Parameters:
- aFormat:
- aTimeZone:
ToLongPrettyDateString
Convert a date to string in a given timezone, long format.
Parameters:
- aTimeZone:
ToOADate .NET, .NET Core 6.0, .NET Standard 2.0, Island, Toffee, ToffeeV2
Convert a datetime to Ole date (double).
Parameters:
- aDateTime:
ToShortDateString
Convert a date to string in a given timezone, short format.
Parameters:
- aTimeZone:
ToShortPrettyDateAndTimeString
Convert a date and time to string in a given timezone, long format.
Parameters:
- aTimeZone:
ToShortPrettyDateString
Convert a date to string in a given timezone, short format.
Parameters:
- aTimeZone:
ToShortTimeString
Convert a time to string in a given timezone, short format.
Parameters:
- aTimeZone:
ToString override virtual .NET, .NET Core 6.0, .NET Standard 2.0, Island
Convert this datetime to stirng.
method ToString: PlatformString
PlatformString ToString()
func ToString() -> PlatformString
Function ToString() As PlatformString
Convert this datetime to stirng with a given timezone.
Parameters:
- aTimeZone:
Convert this datetime to stirng with a given format and timezone.
Parameters:
- Format:
- aTimeZone:
Convert this datetime to stirng with a given format, culture and timezone.
Parameters:
- Format:
- Culture:
- aTimeZone:
ToUnixDate .NET, .NET Core 6.0, .NET Standard 2.0, Island, Toffee, ToffeeV2
method ToUnixDate: Int32
Int32 ToUnixDate()
func ToUnixDate() -> Int32
Function ToUnixDate() As Int32
Parameters:
- aDateTime:
Try to parse a date with a given format, locale and options.
class method TryParse(aDateTime: String; aFormat: String; aLocale: Locale; aOptions: DateParserOptions): nullable DateTime
static DateTime? TryParse(String aDateTime, String aFormat, Locale aLocale, DateParserOptions aOptions)
// Toffee
static func TryParse(_ aDateTime: String, _ aFormat: String, _ aLocale: Locale, _ aOptions: DateParserOptions) -> DateTime
// ToffeeV2
static func TryParse(_ aDateTime: String, _ aFormat: String, _ aLocale: Locale, _ aOptions: DateParserOptions) -> DateTime?
Parameters:
- aDateTime:
- aFormat:
- aLocale:
- aOptions:
Try to parse a date with a given format and options.
class method TryParse(aDateTime: String; aFormat: String; aOptions: DateParserOptions): nullable DateTime
Parameters:
- aDateTime:
- aFormat:
- aOptions:
Try to parse a date with a given locale and options.
class method TryParse(aDateTime: String; aLocale: Locale; aOptions: DateParserOptions): nullable DateTime
Parameters:
- aDateTime:
- aLocale:
- aOptions:
Try to parse a date with the given options.
Parameters:
- aDateTime:
- aOptions:
Parameters:
- aDateTime:
TryParseISO8601 (nullable JsonNode): nullable DateTime .NET, .NET Core 6.0, .NET Standard 2.0, Island, Toffee, ToffeeV2
Parameters:
- aValue:
UtcNow
Current datetime in the UTC timezone.
class property UtcNow: not nullable DateTime read;
class DateTime! UtcNow { get; }
static var UtcNow: DateTime { get{} }
class DateTime UtcNow { __get; }
Shared ReadOnly Property UtcNow() As DateTime
Year
Returns the year.
TicksTill1970
Date
Returns the date without time part.
property Date: DateTime read;
DateTime Date { get; }
var Date: DateTime { get{} }
DateTime Date { __get; }
ReadOnly Property Date() As DateTime
Day
Returns the day of the month (1..31)
property Day: Int32 read;
Int32 Day { get; }
var Day: Int32 { get{} }
Integer Day { __get; }
ReadOnly Property Day() As Int32
DayOfWeek
Returns the day of the week (1..7)
property DayOfWeek: Int32 read;
Int32 DayOfWeek { get; }
var DayOfWeek: Int32 { get{} }
Integer DayOfWeek { __get; }
ReadOnly Property DayOfWeek() As Int32
Hour
Returns the hour (0..23)
property Hour: Int32 read;
Int32 Hour { get; }
var Hour: Int32 { get{} }
Integer Hour { __get; }
ReadOnly Property Hour() As Int32
IsUTC
property IsUTC: Boolean read;
Boolean IsUTC { get; }
var IsUTC: Boolean { get{} }
Boolean IsUTC { __get; }
ReadOnly Property IsUTC() As Boolean
Millisecond .NET, .NET Core 6.0, .NET Standard 2.0, Island, Toffee, ToffeeV2
property Millisecond: Int32 read;
Int32 Millisecond { get; }
var Millisecond: Int32 { get{} }
ReadOnly Property Millisecond() As Int32
Minute
Returns the minutes in this datetime.
property Minute: Int32 read;
Int32 Minute { get; }
var Minute: Int32 { get{} }
Integer Minute { __get; }
ReadOnly Property Minute() As Int32
Month
Returns the month in this datetime.
property Month: Int32 read;
Int32 Month { get; }
var Month: Int32 { get{} }
Integer Month { __get; }
ReadOnly Property Month() As Int32
OffsetToUTC
property OffsetToUTC: Int32 read;
Int32 OffsetToUTC { get; }
var OffsetToUTC: Int32 { get{} }
Integer OffsetToUTC { __get; }
ReadOnly Property OffsetToUTC() As Int32
Second
Returns the seconds in this datetime.
property Second: Int32 read;
Int32 Second { get; }
var Second: Int32 { get{} }
Integer Second { __get; }
ReadOnly Property Second() As Int32
Ticks
Returns the nr of ticks, there are 10 000 000 ticks in a second.
property Ticks: Int64 read;
Int64 Ticks { get; }
var Ticks: Int64 { get{} }
Int64 Ticks { __get; }
ReadOnly Property Ticks() As Int64
TimeSince
Returns the time passed since a given datetime compared to now.
property TimeSince: TimeSpan read;
TimeSpan TimeSince { get; }
var TimeSince: TimeSpan { get{} }
TimeSpan TimeSince { __get; }
ReadOnly Property TimeSince() As TimeSpan
Year
Returns the year.
property Year: Int32 read;
Int32 Year { get; }
var Year: Int32 { get{} }
Integer Year { __get; }
ReadOnly Property Year() As Int32
Today
Returns the current date without time part.
class property Today: not nullable DateTime read;
class DateTime! Today { get; }
static var Today: DateTime { get{} }
class DateTime Today { __get; }
Shared ReadOnly Property Today() As DateTime
UtcNow
Current datetime in the UTC timezone.
Compare
Compares two dates, and returns 0 if the same, -1 if less, 1 if more.
Parameters:
- Value1:
- Value2:
FromOADate
Converts an OLE date to a DateTime
Parameters:
- aOADate:
FromUnixDate
Parameters:
- aUnixDate:
Returns the time passed since a given datetime compared to the current one.
Parameters:
- aOtherDateTime:
Convert a datetime to Ole date (double).
Parameters:
- aDateTime:
Parameters:
- aDateTime:
Try to parse a date with a given format, locale and options.
class method TryParse(aDateTime: String; aFormat: String; aLocale: Locale; aOptions: DateParserOptions): nullable DateTime
static DateTime? TryParse(String aDateTime, String aFormat, Locale aLocale, DateParserOptions aOptions)
// Toffee
static func TryParse(_ aDateTime: String, _ aFormat: String, _ aLocale: Locale, _ aOptions: DateParserOptions) -> DateTime
// ToffeeV2
static func TryParse(_ aDateTime: String, _ aFormat: String, _ aLocale: Locale, _ aOptions: DateParserOptions) -> DateTime?
Parameters:
- aDateTime:
- aFormat:
- aLocale:
- aOptions:
Try to parse a date with a given format and options.
class method TryParse(aDateTime: String; aFormat: String; aOptions: DateParserOptions): nullable DateTime
Parameters:
- aDateTime:
- aFormat:
- aOptions:
Try to parse a date with a given locale and options.
class method TryParse(aDateTime: String; aLocale: Locale; aOptions: DateParserOptions): nullable DateTime
Parameters:
- aDateTime:
- aLocale:
- aOptions:
Try to parse a date with the given options.
Parameters:
- aDateTime:
- aOptions:
Parameters:
- aDateTime:
TryParseISO8601 (nullable JsonNode): nullable DateTime .NET, .NET Core 6.0, .NET Standard 2.0, Island, Toffee, ToffeeV2
Parameters:
- aValue:
constructor .NET, .NET Core 6.0, .NET Standard 2.0
constructor
DateTime()
init()
Sub New()
constructor (Int64)
Creates a new object with a given number of ticks.
constructor(aTicks: Int64)
DateTime(Int64 aTicks)
init(_ aTicks: Int64)
DateTime(Int64 aTicks)
Sub New(aTicks As Int64)
Parameters:
- aTicks:
Creates a new object with a given date.
Parameters:
- aYear:
- aMonth:
- aDay:
Creates a new object with a given date.
Parameters:
- aYear:
- aMonth:
- aDay:
- anHour:
- aMinute:
Creates a new object with a given date.
constructor(aYear: Int32; aMonth: Int32; aDay: Int32; anHour: Int32; aMinute: Int32; aSecond: Int32)
init(_ aYear: Int32, _ aMonth: Int32, _ aDay: Int32, _ anHour: Int32, _ aMinute: Int32, _ aSecond: Int32)
Parameters:
- aYear:
- aMonth:
- aDay:
- anHour:
- aMinute:
- aSecond:
constructor(aYear: Int32; aMonth: Int32; aDay: Int32; anHour: Int32; aMinute: Int32; aSecond: Int32; aMSec: Int32)
DateTime(Int32 aYear, Int32 aMonth, Int32 aDay, Int32 anHour, Int32 aMinute, Int32 aSecond, Int32 aMSec)
init(_ aYear: Int32, _ aMonth: Int32, _ aDay: Int32, _ anHour: Int32, _ aMinute: Int32, _ aSecond: Int32, _ aMSec: Int32)
Parameters:
- aYear:
- aMonth:
- aDay:
- anHour:
- aMinute:
- aSecond:
- aMSec:
Add
Add a timespan to a date, and returning the new date.
Parameters:
- Value:
AddDays
Adds a nr of days and returns a new datetime.
Parameters:
- Value:
AddHours
Adds a nr of hours and returns a new datetime.
Parameters:
- Value:
AddMilliSeconds
Adds a nr of msec and returns a new datetime.
Parameters:
- Value:
AddMinutes
Adds a nr of minutes and returns a new datetime.
Parameters:
- Value:
AddMonths
Adds a nr of months and returns a new datetime.
Parameters:
- Value:
AddSeconds
Adds a nr of seconds and returns a new datetime.
Parameters:
- Value:
AddYears
Adds a nr of years and returns a new datetime.
Parameters:
- Value:
Parameters:
- other:
Compares this date, and returns 0 if the same, -1 if less, 1 if more.
Parameters:
- Value:
ToISO8601String
method ToISO8601String(aFormat: ISO8601Format; aTimeZone: TimeZone): not nullable String
String! ToISO8601String(ISO8601Format aFormat, TimeZone aTimeZone)
func ToISO8601String(_ aFormat: ISO8601Format, _ aTimeZone: TimeZone) -> String
String ToISO8601String(ISO8601Format aFormat, TimeZone aTimeZone)
Function ToISO8601String(aFormat As ISO8601Format, aTimeZone As TimeZone) As String
Parameters:
- aFormat:
- aTimeZone:
ToLongPrettyDateString
Convert a date to string in a given timezone, long format.
Parameters:
- aTimeZone:
ToOADate .NET, .NET Core 6.0, .NET Standard 2.0, Island, Toffee, ToffeeV2
ToShortDateString
Convert a date to string in a given timezone, short format.
Parameters:
- aTimeZone:
ToShortPrettyDateAndTimeString
Convert a date and time to string in a given timezone, long format.
Parameters:
- aTimeZone:
ToShortPrettyDateString
Convert a date to string in a given timezone, short format.
Parameters:
- aTimeZone:
ToShortTimeString
Convert a time to string in a given timezone, short format.
Parameters:
- aTimeZone:
ToString override virtual .NET, .NET Core 6.0, .NET Standard 2.0, Island
Convert this datetime to stirng.
method ToString: PlatformString
PlatformString ToString()
func ToString() -> PlatformString
Function ToString() As PlatformString
Convert this datetime to stirng with a given timezone.
Parameters:
- aTimeZone:
Convert this datetime to stirng with a given format and timezone.
Parameters:
- Format:
- aTimeZone:
Convert this datetime to stirng with a given format, culture and timezone.
Parameters:
- Format:
- Culture:
- aTimeZone:
ToUnixDate .NET, .NET Core 6.0, .NET Standard 2.0, Island, Toffee, ToffeeV2