SDateTime
| دالة | Equals | Returns true if the datetimes are same. |
| دالة | ComparesTo | 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. |
| دالة | FormatLocal | Outputs a custom formatted string with the date and time according to local language rules. |
| دالة | FunctionName | Outputs a custom formatted string with the date and time according to global rules (culture invariant). |
| دالة | Regional | Outputs a string with the date and time formatted according to specific regional rules. |
| دالة | FormatRegional | Outputs a custom formatted string with the date and time according to specific regional rules. |
| دالة | AddYears | Return a new SDateTime that is the current date time + amount years. |
| دالة | AddMonths | Return a new SDateTime that is the current date time + amount months. |
| دالة | AddDays | Return a new SDateTime that is the current date time + amount days. |
| دالة | AddHours | Return a new SDateTime that is the current date time + amount hours. |
| دالة | AddMinutes | Return a new SDateTime that is the current date time + amount minutes. |
| دالة | AddSeconds | Return a new SDateTime that is the current date time + amount seconds. |
| دالة | AddMilliseconds | Return a new SDateTime that is the current date time + amount milliseconds. |
| دالة | Now | Creates a new SDateTime object equal to the current local time. |
| دالة | Server | Creates a new SDateTime object equal to the current server time. |
| دالة | Parse | Creates a new SDateTime object by attempting to parse a string input. |
| دالة | IsLeapYear | Return true if the specified year is a leap year. |
| دالة | DaysInMonth | Return the number of days in the given month for the given year. |
| خاصية | Year | Get the independent time unit property of the SDateTime object. |
| خاصية | Month | – |
| خاصية | Day | – |
| خاصية | Hour | – |
| خاصية | Minute | – |
| خاصية | Second | – |
| خاصية | Millisecond | – |
| خاصية | Local | Outputs a string with the date and time formatted according to local language rules. |
| خاصية | Global | Outputs a string with the date and time formatted according to global rules (culture invariant). |
| خاصية | UnixTime | Return this time in Unix time, the number of seconds since Jan 1st, 1970. |
| خاصية | IsDaylightSavingTime | Indicates whether this instance of DateTime is within the daylight saving time range for the current time zone. |
الدوال
Equals
Returns true if the datetimes are same.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| other | SDateTime | – |
القيم المرجعة
bool
مثال
``` ATargetDateTime = DateTime.Now().AddMinutes(5) AreEqual = ATargetDateTime.Equals(DateTime.Now()) ```
ComparesTo
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.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| other | SDateTime | – |
القيم المرجعة
int
مثال
ATargetDateTime = DateTime.Now().AddMinutes(5)
AreEqual = ATargetDateTime.ComparesTo(DateTime.Now())
FormatLocal
Outputs a custom formatted string with the date and time according to local language rules.
المعاملات
| المعامل | النوع | الوصف |
|---|---|---|
| format | string | See below for examples |
القيم المرجعة
string
مثال
localTimeCustomFormat = DateTime.Now().FormatLocal("dddd, MMMM dd, yyyy h:mm:ss tt")
``` --Example format strings
--[[ format = "dddd, MMMM dd, yyyy h:mm:ss tt" Result: Monday, May 28, 2012 11:35:00 AM
format = "Ldddd, MMMM dd, yyyy" Result: Monday, May 28, 2012
format = "h:mm:ss tt" Result: 11:35:00 AM
format = "MMMM dd" Result: May 28
format = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT" Result: Mon, 28 May 2012 11:35:00 GMT
format = "M/d/yyyy" Result: 5/28/2012
format = "h:mm tt" Result: 11:35 AM
format = "yyyy'-'MM'-'dd'T'HH':'mm':'ss" Result: 2012-05-28T11:35:00
format = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'" Result: 2012-05-28 11:35:00Z
format = "MMMM, yyyy" Result: May, 2012 --]] ```
FunctionName
Outputs a custom formatted string with the date and time according to global rules (culture invariant).
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| format | string | – |
القيم المرجعة
string
مثال
GlobalTimeCustomFormat = DateTime.Now().FormatLocal("dddd, MMMM dd, yyyy h:mm:ss tt")
--Example format strings
--[[
format = "dddd, MMMM dd, yyyy h:mm:ss tt"
Result: Monday, May 28, 2012 11:35:00 AM
format = "Ldddd, MMMM dd, yyyy"
Result: Monday, May 28, 2012
format = "h:mm:ss tt"
Result: 11:35:00 AM
format = "MMMM dd"
Result: May 28
format = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT"
Result: Mon, 28 May 2012 11:35:00 GMT
format = "M/d/yyyy"
Result: 5/28/2012
format = "h:mm tt"
Result: 11:35 AM
format = "yyyy'-'MM'-'dd'T'HH':'mm':'ss"
Result: 2012-05-28T11:35:00
format = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'"
Result: 2012-05-28 11:35:00Z
format = "MMMM, yyyy"
Result: May, 2012
--]]
Regional
Outputs a string with the date and time formatted according to specific regional rules.
المعاملات
| المعامل | النوع | الوصف |
|---|---|---|
| region | string | List available here |
القيم المرجعة
string
مثال
stringTimeRegional = DateTime.Now().Regional('en-us')
FormatRegional
Outputs a custom formatted string with the date and time according to specific regional rules.
المعاملات
| المعامل | النوع | الوصف |
|---|---|---|
| region | string | List available here |
| format | string | See below |
القيم المرجعة
string
مثال
stringTimeFormatRegional = DateTime.Now().FormatRegional('en-us','dddd, MMMM dd, yyyy h:mm:ss tt')
--Example format strings
--[[
format = "dddd, MMMM dd, yyyy h:mm:ss tt"
Result: Monday, May 28, 2012 11:35:00 AM
format = "Ldddd, MMMM dd, yyyy"
Result: Monday, May 28, 2012
format = "h:mm:ss tt"
Result: 11:35:00 AM
format = "MMMM dd"
Result: May 28
format = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT"
Result: Mon, 28 May 2012 11:35:00 GMT
format = "M/d/yyyy"
Result: 5/28/2012
format = "h:mm tt"
Result: 11:35 AM
format = "yyyy'-'MM'-'dd'T'HH':'mm':'ss"
Result: 2012-05-28T11:35:00
format = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'"
Result: 2012-05-28 11:35:00Z
format = "MMMM, yyyy"
Result: May, 2012
--]]
AddYears
Return a new SDateTime that is the current date time + amount years.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| amount | int | – |
القيم المرجعة
SDateTime
مثال
date5YearsLater = DateTime.Now().AddYears(5)
AddMonths
Return a new SDateTime that is the current date time + amount months.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| amount | int | – |
القيم المرجعة
SDateTime
مثال
date5MonthsLater = DateTime.Now().AddMonths(5)
AddDays
Return a new SDateTime that is the current date time + amount days.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| amount | double | – |
القيم المرجعة
SDateTime
مثال
date5DaysLater = DateTime.Now().AddDays(5)
AddHours
Return a new SDateTime that is the current date time + amount hours.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| amount | double | – |
القيم المرجعة
SDateTime
مثال
date5HoursLater = DateTime.Now().AddHours(5)
AddMinutes
Return a new SDateTime that is the current date time + amount minutes.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| amount | double | – |
القيم المرجعة
SDateTime
مثال
date5MinutesLater = DateTime.Now().AddMinutes(5)
AddSeconds
Return a new SDateTime that is the current date time + amount seconds.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| amount | double | – |
القيم المرجعة
SDateTime
مثال
date5SecondsLater = DateTime.Now().AddSeconds(5)
AddMilliseconds
Return a new SDateTime that is the current date time + amount milliseconds.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| amount | double | – |
القيم المرجعة
SDateTime
مثال
date5MillisecondsLater = DateTime.Now().AddMilliseconds(5)
Now
Creates a new SDateTime object equal to the current local time.
القيم المرجعة
SDateTime
مثال
localDateTime = DateTime.Now()
Server
Creates a new SDateTime object equal to the current server time.
القيم المرجعة
SDateTime
مثال
serverDateTime = DateTime.Server()
Parse
Creates a new SDateTime object by attempting to parse a string input. Returns null/nil if the string cannot be parsed.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| input | string | – |
القيم المرجعة
SDateTime
مثال
parseDateTime = DateTime.Parse('10/3/2022 1:26:02 PM')
IsLeapYear
Return true if the specified year is a leap year.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| year | int | – |
القيم المرجعة
bool
مثال
isLeapYear = DateTime.IsLeapYear(2024)
DaysInMonth
Return the number of days in the given month for the given year.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| year | int | – |
| month | int | – |
القيم المرجعة
int
مثال
isLeapYear = DateTime.DaysInMonth(2022, 8)
الخصائص
Yearللقراءة فقط
Get the independent time unit property of the SDateTime object.
مثال
currentYear = DateTime.Now().Year
Monthللقراءة فقط
مثال
currentMonth = DateTime.Now().Month
Dayللقراءة فقط
مثال
currentDay = DateTime.Now().Day
Hourللقراءة فقط
مثال
currentHour = DateTime.Now().Hour
Minuteللقراءة فقط
مثال
currentMinute = DateTime.Now().Minute
Secondللقراءة فقط
مثال
currentSecond = DateTime.Now().Second
Millisecondللقراءة فقط
مثال
currentMillisecond = DateTime.Now().Millisecond
Localللقراءة فقط
Outputs a string with the date and time formatted according to local language rules.
مثال
currentTimeStringLocal = DateTime.Now().Local
Globalللقراءة فقط
Outputs a string with the date and time formatted according to global rules (culture invariant).
مثال
currentTimeStringGlobal = DateTime.Now().Global
UnixTimeللقراءة فقط
Return this time in Unix time, the number of seconds since Jan 1st, 1970.
مثال
currentUnixTime = DateTime.Now().UnixTime
IsDaylightSavingTimeللقراءة فقط
Indicates whether this instance of DateTime is within the daylight saving time range for the current time zone.
مثال
isCurrentTimeDaylightSaving = DateTime.Now().IsDaylightSavingTime



