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 (Date) Cooper
constructor(aDate: Date)
DateTime(Date aDate)
init(_ aDate: Date)
DateTime(Date aDate)
Sub New(aDate As Date)
Parameters:
- aDate:
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.
constructor(aYear: Int32; aMonth: Int32; aDay: Int32)
DateTime(Int32 aYear, Int32 aMonth, Int32 aDay)
init(_ aYear: Int32, _ aMonth: Int32, _ aDay: Int32)
DateTime(Integer aYear, Integer aMonth, Integer aDay)
Sub New(aYear As Int32, aMonth As Int32, aDay As Int32)
Parameters:
- aYear:
- aMonth:
- aDay:
Creates a new object with a given date.
constructor(aYear: Int32; aMonth: Int32; aDay: Int32; anHour: Int32; aMinute: Int32)
DateTime(Int32 aYear, Int32 aMonth, Int32 aDay, Int32 anHour, Int32 aMinute)
init(_ aYear: Int32, _ aMonth: Int32, _ aDay: Int32, _ anHour: Int32, _ aMinute: Int32)
DateTime(Integer aYear, Integer aMonth, Integer aDay, Integer anHour, Integer aMinute)
Sub New(aYear As Int32, aMonth As Int32, aDay As Int32, anHour As Int32, aMinute As Int32)
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)
DateTime(Int32 aYear, Int32 aMonth, Int32 aDay, Int32 anHour, Int32 aMinute, Int32 aSecond)
init(_ aYear: Int32, _ aMonth: Int32, _ aDay: Int32, _ anHour: Int32, _ aMinute: Int32, _ aSecond: Int32)
DateTime(Integer aYear, Integer aMonth, Integer aDay, Integer anHour, Integer aMinute, Integer aSecond)
Sub New(aYear As Int32, aMonth As Int32, aDay As Int32, anHour As Int32, aMinute As Int32, aSecond As 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)
DateTime(Integer aYear, Integer aMonth, Integer aDay, Integer anHour, Integer aMinute, Integer aSecond, Integer aMSec)
Sub New(aYear As Int32, aMonth As Int32, aDay As Int32, anHour As Int32, aMinute As Int32, aSecond As Int32, aMSec As Int32)
Parameters:
- aYear:
- aMonth:
- aDay:
- anHour:
- aMinute:
- aSecond:
- aMSec:
Add
Add a timespan to a date, and returning the new date.
method Add(Value: TimeSpan): not nullable DateTime
DateTime! Add(TimeSpan Value)
func Add(_ Value: TimeSpan) -> DateTime
DateTime Add(TimeSpan Value)
Function Add(Value As TimeSpan) As DateTime
Parameters:
- Value:
AddDays
Adds a nr of days and returns a new datetime.
method AddDays(Value: Int32): not nullable DateTime
DateTime! AddDays(Int32 Value)
func AddDays(_ Value: Int32) -> DateTime
DateTime AddDays(Integer Value)
Function AddDays(Value As Int32) As DateTime
Parameters:
- Value:
AddHours
Adds a nr of hours and returns a new datetime.
method AddHours(Value: Int32): not nullable DateTime
DateTime! AddHours(Int32 Value)
func AddHours(_ Value: Int32) -> DateTime
DateTime AddHours(Integer Value)
Function AddHours(Value As Int32) As DateTime
Parameters:
- Value:
AddMilliSeconds
Adds a nr of msec and returns a new datetime.
method AddMilliSeconds(Value: Int32): not nullable DateTime
DateTime! AddMilliSeconds(Int32 Value)
func AddMilliSeconds(_ Value: Int32) -> DateTime
DateTime AddMilliSeconds(Integer Value)
Function AddMilliSeconds(Value As Int32) As DateTime
Parameters:
- Value:
AddMinutes
Adds a nr of minutes and returns a new datetime.
method AddMinutes(Value: Int32): not nullable DateTime
DateTime! AddMinutes(Int32 Value)
func AddMinutes(_ Value: Int32) -> DateTime
DateTime AddMinutes(Integer Value)
Function AddMinutes(Value As Int32) As DateTime
Parameters:
- Value:
AddMonths
Adds a nr of months and returns a new datetime.
method AddMonths(Value: Int32): not nullable DateTime
DateTime! AddMonths(Int32 Value)
func AddMonths(_ Value: Int32) -> DateTime
DateTime AddMonths(Integer Value)
Function AddMonths(Value As Int32) As DateTime
Parameters:
- Value:
AddSeconds
Adds a nr of seconds and returns a new datetime.
method AddSeconds(Value: Int32): not nullable DateTime
DateTime! AddSeconds(Int32 Value)
func AddSeconds(_ Value: Int32) -> DateTime
DateTime AddSeconds(Integer Value)
Function AddSeconds(Value As Int32) As DateTime
Parameters:
- Value:
AddYears
Adds a nr of years and returns a new datetime.
method AddYears(Value: Int32): not nullable DateTime
DateTime! AddYears(Int32 Value)
func AddYears(_ Value: Int32) -> DateTime
DateTime AddYears(Integer Value)
Function AddYears(Value As Int32) As DateTime
Parameters:
- Value:
Compare
Compares two dates, and returns 0 if the same, -1 if less, 1 if more.
class method Compare(Value1: DateTime; Value2: DateTime): Int32
static Int32 Compare(DateTime Value1, DateTime Value2)
static func Compare(_ Value1: DateTime, _ Value2: DateTime) -> Int32
static Integer Compare(DateTime Value1, DateTime Value2)
Shared Function Compare(Value1 As DateTime, Value2 As DateTime) As Int32
Parameters:
- Value1:
- Value2:
method CompareTo(other: Object): Int32
Int32 CompareTo(Object other)
func CompareTo(_ other: Object) -> Int32
Function CompareTo(other As Object) As Int32
Parameters:
- other:
Compares this date, and returns 0 if the same, -1 if less, 1 if more.
method CompareTo(Value: DateTime): Int32
Int32 CompareTo(DateTime Value)
func CompareTo(_ Value: DateTime) -> Int32
Integer CompareTo(DateTime Value)
Function CompareTo(Value As DateTime) As Int32
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
class method FromOADate(aOADate: Double): not nullable DateTime
static DateTime! FromOADate(Double aOADate)
static func FromOADate(_ aOADate: Double) -> DateTime
static DateTime FromOADate(Double aOADate)
Shared Function FromOADate(aOADate As Double) As DateTime
Parameters:
- aOADate:
FromUnixDate
class method FromUnixDate(aUnixDate: Int32): not nullable DateTime
static DateTime! FromUnixDate(Int32 aUnixDate)
static func FromUnixDate(_ aUnixDate: Int32) -> DateTime
static DateTime FromUnixDate(Integer aUnixDate)
Shared Function FromUnixDate(aUnixDate As Int32) As DateTime
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
property Millisecond: Int32 read;
Int32 Millisecond { get; }
var Millisecond: Int32 { get{} }
Integer Millisecond { __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
Const TicksTill1970 As Int64 = 621355968000000000
Returns the time passed since a given datetime compared to the current one.
class method TimeSince(aOtherDateTime: DateTime): TimeSpan
static TimeSpan TimeSince(DateTime aOtherDateTime)
static func TimeSince(_ aOtherDateTime: DateTime) -> TimeSpan
static TimeSpan TimeSince(DateTime aOtherDateTime)
Shared Function TimeSince(aOtherDateTime As DateTime) As TimeSpan
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 := ISO8601Format.Standard; aTimeZone: TimeZone := nil): not nullable String
String! ToISO8601String(ISO8601Format aFormat = ISO8601Format.Standard, TimeZone aTimeZone = null)
func ToISO8601String(_ aFormat: ISO8601Format = ISO8601Format.Standard, _ aTimeZone: TimeZone = nil) -> String
String ToISO8601String(ISO8601Format aFormat, TimeZone aTimeZone)
Function ToISO8601String(aFormat As ISO8601Format = ISO8601Format.Standard, aTimeZone As TimeZone = Null) As String
Parameters:
- aFormat:
- aTimeZone:
ToLongPrettyDateString
Convert a date to string in a given timezone, long format.
method ToLongPrettyDateString(aTimeZone: TimeZone := nil): not nullable String
String! ToLongPrettyDateString(TimeZone aTimeZone = null)
func ToLongPrettyDateString(_ aTimeZone: TimeZone = nil) -> String
String ToLongPrettyDateString(TimeZone aTimeZone)
Function ToLongPrettyDateString(aTimeZone As TimeZone = Null) As String
Parameters:
- aTimeZone:
ToOADate
method ToOADate: Double
Double ToOADate()
func ToOADate() -> Double
Double ToOADate()
Function ToOADate() As Double
Convert a datetime to Ole date (double).
class method ToOADate(aDateTime: not nullable DateTime): Double
static Double ToOADate(DateTime! aDateTime)
static func ToOADate(_ aDateTime: DateTime) -> Double
static Double ToOADate(DateTime aDateTime)
Shared Function ToOADate(aDateTime As DateTime) As Double
Parameters:
- aDateTime:
ToShortDateString
Convert a date to string in a given timezone, short format.
method ToShortDateString(aTimeZone: TimeZone := nil): not nullable String
String! ToShortDateString(TimeZone aTimeZone = null)
func ToShortDateString(_ aTimeZone: TimeZone = nil) -> String
String ToShortDateString(TimeZone aTimeZone)
Function ToShortDateString(aTimeZone As TimeZone = Null) As String
Parameters:
- aTimeZone:
ToShortPrettyDateAndTimeString
Convert a date and time to string in a given timezone, long format.
method ToShortPrettyDateAndTimeString(aTimeZone: TimeZone := nil): not nullable String
String! ToShortPrettyDateAndTimeString(TimeZone aTimeZone = null)
func ToShortPrettyDateAndTimeString(_ aTimeZone: TimeZone = nil) -> String
String ToShortPrettyDateAndTimeString(TimeZone aTimeZone)
Function ToShortPrettyDateAndTimeString(aTimeZone As TimeZone = Null) As String
Parameters:
- aTimeZone:
ToShortPrettyDateString
Convert a date to string in a given timezone, short format.
method ToShortPrettyDateString(aTimeZone: TimeZone := nil): not nullable String
String! ToShortPrettyDateString(TimeZone aTimeZone = null)
func ToShortPrettyDateString(_ aTimeZone: TimeZone = nil) -> String
String ToShortPrettyDateString(TimeZone aTimeZone)
Function ToShortPrettyDateString(aTimeZone As TimeZone = Null) As String
Parameters:
- aTimeZone:
ToShortTimeString
Convert a time to string in a given timezone, short format.
method ToShortTimeString(aTimeZone: TimeZone := nil): not nullable String
String! ToShortTimeString(TimeZone aTimeZone = null)
func ToShortTimeString(_ aTimeZone: TimeZone = nil) -> String
String ToShortTimeString(TimeZone aTimeZone)
Function ToShortTimeString(aTimeZone As TimeZone = Null) As String
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.
method ToString(aTimeZone: TimeZone := nil): not nullable String
String! ToString(TimeZone aTimeZone = null)
func ToString(_ aTimeZone: TimeZone = nil) -> String
String ToString(TimeZone aTimeZone)
Function ToString(aTimeZone As TimeZone = Null) As String
Parameters:
- aTimeZone:
Convert this datetime to stirng with a given format and timezone.
method ToString(Format: String; aTimeZone: TimeZone := nil): not nullable String
String! ToString(String Format, TimeZone aTimeZone = null)
func ToString(_ Format: String, _ aTimeZone: TimeZone = nil) -> String
String ToString(String Format, TimeZone aTimeZone)
Function ToString(Format As String, aTimeZone As TimeZone = Null) As String
Parameters:
- Format:
- aTimeZone:
Convert this datetime to stirng with a given format, culture and timezone.
method ToString(Format: String; Culture: String; aTimeZone: TimeZone := nil): not nullable String
String! ToString(String Format, String Culture, TimeZone aTimeZone = null)
func ToString(_ Format: String, _ Culture: String, _ aTimeZone: TimeZone = nil) -> String
String ToString(String Format, String Culture, TimeZone aTimeZone)
Function ToString(Format As String, Culture As String, aTimeZone As TimeZone = Null) As String
Parameters:
- Format:
- Culture:
- aTimeZone:
ToUnixDate
method ToUnixDate: Int32
Int32 ToUnixDate()
func ToUnixDate() -> Int32
Integer ToUnixDate()
Function ToUnixDate() As Int32
class method ToUnixDate(aDateTime: not nullable DateTime): Int32
static Int32 ToUnixDate(DateTime! aDateTime)
static func ToUnixDate(_ aDateTime: DateTime) -> Int32
static Integer ToUnixDate(DateTime aDateTime)
Shared Function ToUnixDate(aDateTime As DateTime) 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 := nil): nullable DateTime
static DateTime? TryParse(String aDateTime, String aFormat, Locale aLocale, DateParserOptions aOptions = null)
// Toffee
static func TryParse(_ aDateTime: String, _ aFormat: String, _ aLocale: Locale, _ aOptions: DateParserOptions = nil) -> DateTime
// ToffeeV2
static func TryParse(_ aDateTime: String, _ aFormat: String, _ aLocale: Locale, _ aOptions: DateParserOptions = nil) -> DateTime?
static DateTime TryParse(String aDateTime, String aFormat, Locale aLocale, DateParserOptions aOptions)
Shared Function TryParse(aDateTime As String, aFormat As String, aLocale As Locale, aOptions As DateParserOptions = Null) As 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 := nil): nullable DateTime
static DateTime? TryParse(String aDateTime, String aFormat, DateParserOptions aOptions = null)
// Toffee
static func TryParse(_ aDateTime: String, _ aFormat: String, _ aOptions: DateParserOptions = nil) -> DateTime
// ToffeeV2
static func TryParse(_ aDateTime: String, _ aFormat: String, _ aOptions: DateParserOptions = nil) -> DateTime?
static DateTime TryParse(String aDateTime, String aFormat, DateParserOptions aOptions)
Shared Function TryParse(aDateTime As String, aFormat As String, aOptions As DateParserOptions = Null) As 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 := nil): nullable DateTime
static DateTime? TryParse(String aDateTime, Locale aLocale, DateParserOptions aOptions = null)
// Toffee
static func TryParse(_ aDateTime: String, _ aLocale: Locale, _ aOptions: DateParserOptions = nil) -> DateTime
// ToffeeV2
static func TryParse(_ aDateTime: String, _ aLocale: Locale, _ aOptions: DateParserOptions = nil) -> DateTime?
static DateTime TryParse(String aDateTime, Locale aLocale, DateParserOptions aOptions)
Shared Function TryParse(aDateTime As String, aLocale As Locale, aOptions As DateParserOptions = Null) As DateTime?
Parameters:
- aDateTime:
- aLocale:
- aOptions:
Try to parse a date with the given options.
class method TryParse(aDateTime: String; aOptions: DateParserOptions := nil): nullable DateTime
static DateTime? TryParse(String aDateTime, DateParserOptions aOptions = null)
// Toffee
static func TryParse(_ aDateTime: String, _ aOptions: DateParserOptions = nil) -> DateTime
// ToffeeV2
static func TryParse(_ aDateTime: String, _ aOptions: DateParserOptions = nil) -> DateTime?
static DateTime TryParse(String aDateTime, DateParserOptions aOptions)
Shared Function TryParse(aDateTime As String, aOptions As DateParserOptions = Null) As DateTime?
Parameters:
- aDateTime:
- aOptions:
class method TryParseISO8601(aDateTime: String): nullable DateTime
static DateTime? TryParseISO8601(String aDateTime)
// Toffee
static func TryParseISO8601(_ aDateTime: String) -> DateTime
// ToffeeV2
static func TryParseISO8601(_ aDateTime: String) -> DateTime?
static DateTime TryParseISO8601(String aDateTime)
Shared Function TryParseISO8601(aDateTime As String) As DateTime?
Parameters:
- aDateTime:
class method TryParseISO8601(aValue: nullable JsonNode): nullable DateTime
static DateTime? TryParseISO8601(JsonNode? aValue)
// Toffee
static func TryParseISO8601(_ aValue: JsonNode) -> DateTime
// ToffeeV2
static func TryParseISO8601(_ aValue: JsonNode?) -> DateTime?
static DateTime TryParseISO8601(JsonNode aValue)
Shared Function TryParseISO8601(aValue As JsonNode?) As DateTime?
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.
property Year: Int32 read;
Int32 Year { get; }
var Year: Int32 { get{} }
Integer Year { __get; }
ReadOnly Property Year() As Int32
TicksTill1970
const TicksTill1970: Int64 = 621355968000000000
const Int64 TicksTill1970 = 621355968000000000
static let TicksTill1970: Int64 = 621355968000000000
static final Int64 TicksTill1970 = 621355968000000000
Const TicksTill1970 As Int64 = 621355968000000000
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
property Millisecond: Int32 read;
Int32 Millisecond { get; }
var Millisecond: Int32 { get{} }
Integer Millisecond { __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.
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
Compare
Compares two dates, and returns 0 if the same, -1 if less, 1 if more.
class method Compare(Value1: DateTime; Value2: DateTime): Int32
static Int32 Compare(DateTime Value1, DateTime Value2)
static func Compare(_ Value1: DateTime, _ Value2: DateTime) -> Int32
static Integer Compare(DateTime Value1, DateTime Value2)
Shared Function Compare(Value1 As DateTime, Value2 As DateTime) As Int32
Parameters:
- Value1:
- Value2:
FromOADate
Converts an OLE date to a DateTime
class method FromOADate(aOADate: Double): not nullable DateTime
static DateTime! FromOADate(Double aOADate)
static func FromOADate(_ aOADate: Double) -> DateTime
static DateTime FromOADate(Double aOADate)
Shared Function FromOADate(aOADate As Double) As DateTime
Parameters:
- aOADate:
FromUnixDate
class method FromUnixDate(aUnixDate: Int32): not nullable DateTime
static DateTime! FromUnixDate(Int32 aUnixDate)
static func FromUnixDate(_ aUnixDate: Int32) -> DateTime
static DateTime FromUnixDate(Integer aUnixDate)
Shared Function FromUnixDate(aUnixDate As Int32) As DateTime
Parameters:
- aUnixDate:
Returns the time passed since a given datetime compared to the current one.
class method TimeSince(aOtherDateTime: DateTime): TimeSpan
static TimeSpan TimeSince(DateTime aOtherDateTime)
static func TimeSince(_ aOtherDateTime: DateTime) -> TimeSpan
static TimeSpan TimeSince(DateTime aOtherDateTime)
Shared Function TimeSince(aOtherDateTime As DateTime) As TimeSpan
Parameters:
- aOtherDateTime:
Convert a datetime to Ole date (double).
class method ToOADate(aDateTime: not nullable DateTime): Double
static Double ToOADate(DateTime! aDateTime)
static func ToOADate(_ aDateTime: DateTime) -> Double
static Double ToOADate(DateTime aDateTime)
Shared Function ToOADate(aDateTime As DateTime) As Double
Parameters:
- aDateTime:
class method ToUnixDate(aDateTime: not nullable DateTime): Int32
static Int32 ToUnixDate(DateTime! aDateTime)
static func ToUnixDate(_ aDateTime: DateTime) -> Int32
static Integer ToUnixDate(DateTime aDateTime)
Shared Function ToUnixDate(aDateTime As DateTime) 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 := nil): nullable DateTime
static DateTime? TryParse(String aDateTime, String aFormat, Locale aLocale, DateParserOptions aOptions = null)
// Toffee
static func TryParse(_ aDateTime: String, _ aFormat: String, _ aLocale: Locale, _ aOptions: DateParserOptions = nil) -> DateTime
// ToffeeV2
static func TryParse(_ aDateTime: String, _ aFormat: String, _ aLocale: Locale, _ aOptions: DateParserOptions = nil) -> DateTime?
static DateTime TryParse(String aDateTime, String aFormat, Locale aLocale, DateParserOptions aOptions)
Shared Function TryParse(aDateTime As String, aFormat As String, aLocale As Locale, aOptions As DateParserOptions = Null) As 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 := nil): nullable DateTime
static DateTime? TryParse(String aDateTime, String aFormat, DateParserOptions aOptions = null)
// Toffee
static func TryParse(_ aDateTime: String, _ aFormat: String, _ aOptions: DateParserOptions = nil) -> DateTime
// ToffeeV2
static func TryParse(_ aDateTime: String, _ aFormat: String, _ aOptions: DateParserOptions = nil) -> DateTime?
static DateTime TryParse(String aDateTime, String aFormat, DateParserOptions aOptions)
Shared Function TryParse(aDateTime As String, aFormat As String, aOptions As DateParserOptions = Null) As 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 := nil): nullable DateTime
static DateTime? TryParse(String aDateTime, Locale aLocale, DateParserOptions aOptions = null)
// Toffee
static func TryParse(_ aDateTime: String, _ aLocale: Locale, _ aOptions: DateParserOptions = nil) -> DateTime
// ToffeeV2
static func TryParse(_ aDateTime: String, _ aLocale: Locale, _ aOptions: DateParserOptions = nil) -> DateTime?
static DateTime TryParse(String aDateTime, Locale aLocale, DateParserOptions aOptions)
Shared Function TryParse(aDateTime As String, aLocale As Locale, aOptions As DateParserOptions = Null) As DateTime?
Parameters:
- aDateTime:
- aLocale:
- aOptions:
Try to parse a date with the given options.
class method TryParse(aDateTime: String; aOptions: DateParserOptions := nil): nullable DateTime
static DateTime? TryParse(String aDateTime, DateParserOptions aOptions = null)
// Toffee
static func TryParse(_ aDateTime: String, _ aOptions: DateParserOptions = nil) -> DateTime
// ToffeeV2
static func TryParse(_ aDateTime: String, _ aOptions: DateParserOptions = nil) -> DateTime?
static DateTime TryParse(String aDateTime, DateParserOptions aOptions)
Shared Function TryParse(aDateTime As String, aOptions As DateParserOptions = Null) As DateTime?
Parameters:
- aDateTime:
- aOptions:
class method TryParseISO8601(aDateTime: String): nullable DateTime
static DateTime? TryParseISO8601(String aDateTime)
// Toffee
static func TryParseISO8601(_ aDateTime: String) -> DateTime
// ToffeeV2
static func TryParseISO8601(_ aDateTime: String) -> DateTime?
static DateTime TryParseISO8601(String aDateTime)
Shared Function TryParseISO8601(aDateTime As String) As DateTime?
Parameters:
- aDateTime:
class method TryParseISO8601(aValue: nullable JsonNode): nullable DateTime
static DateTime? TryParseISO8601(JsonNode? aValue)
// Toffee
static func TryParseISO8601(_ aValue: JsonNode) -> DateTime
// ToffeeV2
static func TryParseISO8601(_ aValue: JsonNode?) -> DateTime?
static DateTime TryParseISO8601(JsonNode aValue)
Shared Function TryParseISO8601(aValue As JsonNode?) As DateTime?
Parameters:
- aValue:
constructor .NET, .NET Core 6.0, .NET Standard 2.0
constructor
DateTime()
init()
Sub New()
constructor (Date) Cooper
constructor(aDate: Date)
DateTime(Date aDate)
init(_ aDate: Date)
DateTime(Date aDate)
Sub New(aDate As Date)
Parameters:
- aDate:
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.
constructor(aYear: Int32; aMonth: Int32; aDay: Int32)
DateTime(Int32 aYear, Int32 aMonth, Int32 aDay)
init(_ aYear: Int32, _ aMonth: Int32, _ aDay: Int32)
DateTime(Integer aYear, Integer aMonth, Integer aDay)
Sub New(aYear As Int32, aMonth As Int32, aDay As Int32)
Parameters:
- aYear:
- aMonth:
- aDay:
Creates a new object with a given date.
constructor(aYear: Int32; aMonth: Int32; aDay: Int32; anHour: Int32; aMinute: Int32)
DateTime(Int32 aYear, Int32 aMonth, Int32 aDay, Int32 anHour, Int32 aMinute)
init(_ aYear: Int32, _ aMonth: Int32, _ aDay: Int32, _ anHour: Int32, _ aMinute: Int32)
DateTime(Integer aYear, Integer aMonth, Integer aDay, Integer anHour, Integer aMinute)
Sub New(aYear As Int32, aMonth As Int32, aDay As Int32, anHour As Int32, aMinute As Int32)
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)
DateTime(Int32 aYear, Int32 aMonth, Int32 aDay, Int32 anHour, Int32 aMinute, Int32 aSecond)
init(_ aYear: Int32, _ aMonth: Int32, _ aDay: Int32, _ anHour: Int32, _ aMinute: Int32, _ aSecond: Int32)
DateTime(Integer aYear, Integer aMonth, Integer aDay, Integer anHour, Integer aMinute, Integer aSecond)
Sub New(aYear As Int32, aMonth As Int32, aDay As Int32, anHour As Int32, aMinute As Int32, aSecond As 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)
DateTime(Integer aYear, Integer aMonth, Integer aDay, Integer anHour, Integer aMinute, Integer aSecond, Integer aMSec)
Sub New(aYear As Int32, aMonth As Int32, aDay As Int32, anHour As Int32, aMinute As Int32, aSecond As Int32, aMSec As Int32)
Parameters:
- aYear:
- aMonth:
- aDay:
- anHour:
- aMinute:
- aSecond:
- aMSec:
Add
Add a timespan to a date, and returning the new date.
method Add(Value: TimeSpan): not nullable DateTime
DateTime! Add(TimeSpan Value)
func Add(_ Value: TimeSpan) -> DateTime
DateTime Add(TimeSpan Value)
Function Add(Value As TimeSpan) As DateTime
Parameters:
- Value:
AddDays
Adds a nr of days and returns a new datetime.
method AddDays(Value: Int32): not nullable DateTime
DateTime! AddDays(Int32 Value)
func AddDays(_ Value: Int32) -> DateTime
DateTime AddDays(Integer Value)
Function AddDays(Value As Int32) As DateTime
Parameters:
- Value:
AddHours
Adds a nr of hours and returns a new datetime.
method AddHours(Value: Int32): not nullable DateTime
DateTime! AddHours(Int32 Value)
func AddHours(_ Value: Int32) -> DateTime
DateTime AddHours(Integer Value)
Function AddHours(Value As Int32) As DateTime
Parameters:
- Value:
AddMilliSeconds
Adds a nr of msec and returns a new datetime.
method AddMilliSeconds(Value: Int32): not nullable DateTime
DateTime! AddMilliSeconds(Int32 Value)
func AddMilliSeconds(_ Value: Int32) -> DateTime
DateTime AddMilliSeconds(Integer Value)
Function AddMilliSeconds(Value As Int32) As DateTime
Parameters:
- Value:
AddMinutes
Adds a nr of minutes and returns a new datetime.
method AddMinutes(Value: Int32): not nullable DateTime
DateTime! AddMinutes(Int32 Value)
func AddMinutes(_ Value: Int32) -> DateTime
DateTime AddMinutes(Integer Value)
Function AddMinutes(Value As Int32) As DateTime
Parameters:
- Value:
AddMonths
Adds a nr of months and returns a new datetime.
method AddMonths(Value: Int32): not nullable DateTime
DateTime! AddMonths(Int32 Value)
func AddMonths(_ Value: Int32) -> DateTime
DateTime AddMonths(Integer Value)
Function AddMonths(Value As Int32) As DateTime
Parameters:
- Value:
AddSeconds
Adds a nr of seconds and returns a new datetime.
method AddSeconds(Value: Int32): not nullable DateTime
DateTime! AddSeconds(Int32 Value)
func AddSeconds(_ Value: Int32) -> DateTime
DateTime AddSeconds(Integer Value)
Function AddSeconds(Value As Int32) As DateTime
Parameters:
- Value:
AddYears
Adds a nr of years and returns a new datetime.
method AddYears(Value: Int32): not nullable DateTime
DateTime! AddYears(Int32 Value)
func AddYears(_ Value: Int32) -> DateTime
DateTime AddYears(Integer Value)
Function AddYears(Value As Int32) As DateTime
Parameters:
- Value:
method CompareTo(other: Object): Int32
Int32 CompareTo(Object other)
func CompareTo(_ other: Object) -> Int32
Function CompareTo(other As Object) As Int32
Parameters:
- other:
Compares this date, and returns 0 if the same, -1 if less, 1 if more.
method CompareTo(Value: DateTime): Int32
Int32 CompareTo(DateTime Value)
func CompareTo(_ Value: DateTime) -> Int32
Integer CompareTo(DateTime Value)
Function CompareTo(Value As DateTime) As Int32
Parameters:
- Value:
ToISO8601String
method ToISO8601String(aFormat: ISO8601Format := ISO8601Format.Standard; aTimeZone: TimeZone := nil): not nullable String
String! ToISO8601String(ISO8601Format aFormat = ISO8601Format.Standard, TimeZone aTimeZone = null)
func ToISO8601String(_ aFormat: ISO8601Format = ISO8601Format.Standard, _ aTimeZone: TimeZone = nil) -> String
String ToISO8601String(ISO8601Format aFormat, TimeZone aTimeZone)
Function ToISO8601String(aFormat As ISO8601Format = ISO8601Format.Standard, aTimeZone As TimeZone = Null) As String
Parameters:
- aFormat:
- aTimeZone:
ToLongPrettyDateString
Convert a date to string in a given timezone, long format.
method ToLongPrettyDateString(aTimeZone: TimeZone := nil): not nullable String
String! ToLongPrettyDateString(TimeZone aTimeZone = null)
func ToLongPrettyDateString(_ aTimeZone: TimeZone = nil) -> String
String ToLongPrettyDateString(TimeZone aTimeZone)
Function ToLongPrettyDateString(aTimeZone As TimeZone = Null) As String
Parameters:
- aTimeZone:
ToOADate
method ToOADate: Double
Double ToOADate()
func ToOADate() -> Double
Double ToOADate()
Function ToOADate() As Double
ToShortDateString
Convert a date to string in a given timezone, short format.
method ToShortDateString(aTimeZone: TimeZone := nil): not nullable String
String! ToShortDateString(TimeZone aTimeZone = null)
func ToShortDateString(_ aTimeZone: TimeZone = nil) -> String
String ToShortDateString(TimeZone aTimeZone)
Function ToShortDateString(aTimeZone As TimeZone = Null) As String
Parameters:
- aTimeZone:
ToShortPrettyDateAndTimeString
Convert a date and time to string in a given timezone, long format.
method ToShortPrettyDateAndTimeString(aTimeZone: TimeZone := nil): not nullable String
String! ToShortPrettyDateAndTimeString(TimeZone aTimeZone = null)
func ToShortPrettyDateAndTimeString(_ aTimeZone: TimeZone = nil) -> String
String ToShortPrettyDateAndTimeString(TimeZone aTimeZone)
Function ToShortPrettyDateAndTimeString(aTimeZone As TimeZone = Null) As String
Parameters:
- aTimeZone:
ToShortPrettyDateString
Convert a date to string in a given timezone, short format.
method ToShortPrettyDateString(aTimeZone: TimeZone := nil): not nullable String
String! ToShortPrettyDateString(TimeZone aTimeZone = null)
func ToShortPrettyDateString(_ aTimeZone: TimeZone = nil) -> String
String ToShortPrettyDateString(TimeZone aTimeZone)
Function ToShortPrettyDateString(aTimeZone As TimeZone = Null) As String
Parameters:
- aTimeZone:
ToShortTimeString
Convert a time to string in a given timezone, short format.
method ToShortTimeString(aTimeZone: TimeZone := nil): not nullable String
String! ToShortTimeString(TimeZone aTimeZone = null)
func ToShortTimeString(_ aTimeZone: TimeZone = nil) -> String
String ToShortTimeString(TimeZone aTimeZone)
Function ToShortTimeString(aTimeZone As TimeZone = Null) As String
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.
method ToString(aTimeZone: TimeZone := nil): not nullable String
String! ToString(TimeZone aTimeZone = null)
func ToString(_ aTimeZone: TimeZone = nil) -> String
String ToString(TimeZone aTimeZone)
Function ToString(aTimeZone As TimeZone = Null) As String
Parameters:
- aTimeZone:
Convert this datetime to stirng with a given format and timezone.
method ToString(Format: String; aTimeZone: TimeZone := nil): not nullable String
String! ToString(String Format, TimeZone aTimeZone = null)
func ToString(_ Format: String, _ aTimeZone: TimeZone = nil) -> String
String ToString(String Format, TimeZone aTimeZone)
Function ToString(Format As String, aTimeZone As TimeZone = Null) As String
Parameters:
- Format:
- aTimeZone:
Convert this datetime to stirng with a given format, culture and timezone.
method ToString(Format: String; Culture: String; aTimeZone: TimeZone := nil): not nullable String
String! ToString(String Format, String Culture, TimeZone aTimeZone = null)
func ToString(_ Format: String, _ Culture: String, _ aTimeZone: TimeZone = nil) -> String
String ToString(String Format, String Culture, TimeZone aTimeZone)
Function ToString(Format As String, Culture As String, aTimeZone As TimeZone = Null) As String
Parameters:
- Format:
- Culture:
- aTimeZone:
ToUnixDate
method ToUnixDate: Int32
Int32 ToUnixDate()
func ToUnixDate() -> Int32
Integer ToUnixDate()
Function ToUnixDate() As Int32