Class DateTimeExtensions
Defines a static class containing extension methods for the System.DateTime structure.
Inheritance
Inherited Members
Namespace: Juhta.Net.Extensions
Assembly: Juhta.Net.dll
Syntax
public static class DateTimeExtensions
Methods
| Improve this Doc View SourceToDigitTimestamp(DateTime)
Converts the value of the current DateTime instance to an equivalent 21-digit timestamp.
Declaration
public static string ToDigitTimestamp(this DateTime dateTime)
Parameters
| Type | Name | Description |
|---|---|---|
| System.DateTime | dateTime | Specifies the current DateTime instance. |
Returns
| Type | Description |
|---|---|
| System.String | Returns the value of the current DateTime instance as a 21-digit timestamp. |
Remarks
Digit timestamps contain no separators between the timestamp parts. The number of digits expressing fractional seconds is 7.
ToTimestamp(DateTime)
Converts the value of the current DateTime instance to an equivalent timestamp string.
Declaration
public static string ToTimestamp(this DateTime dateTime)
Parameters
| Type | Name | Description |
|---|---|---|
| System.DateTime | dateTime | Specifies the current DateTime instance. |
Returns
| Type | Description |
|---|---|
| System.String | Returns the value of the current DateTime instance as a timestamp string. |
ToTimestamp(DateTime, Char)
Converts the value of the current DateTime instance to an equivalent timestamp string.
Declaration
public static string ToTimestamp(this DateTime dateTime, char dateTimeSeparator)
Parameters
| Type | Name | Description |
|---|---|---|
| System.DateTime | dateTime | Specifies the current DateTime instance. |
| System.Char | dateTimeSeparator | Specifies a character that is used to separate the date and time part in the timestamp. |
Returns
| Type | Description |
|---|---|
| System.String | Returns the value of the current DateTime instance as a timestamp string. |
ToTimestamp(DateTime, Char, Boolean)
Converts the value of the current DateTime instance to an equivalent timestamp string.
Declaration
public static string ToTimestamp(this DateTime dateTime, char dateTimeSeparator, bool addFractionalSeconds)
Parameters
| Type | Name | Description |
|---|---|---|
| System.DateTime | dateTime | Specifies the current DateTime instance. |
| System.Char | dateTimeSeparator | Specifies a character that is used to separate the date and time part in the timestamp. |
| System.Boolean | addFractionalSeconds | If true, adds fractional seconds to the timestamp. |
Returns
| Type | Description |
|---|---|
| System.String | Returns the value of the current DateTime instance as a timestamp string. |
ToTimestamp(DateTime, Char, Boolean, Boolean)
Converts the value of the current DateTime instance to an equivalent timestamp string.
Declaration
public static string ToTimestamp(this DateTime dateTime, char dateTimeSeparator, bool addFractionalSeconds, bool addUtcOffset)
Parameters
| Type | Name | Description |
|---|---|---|
| System.DateTime | dateTime | Specifies the current DateTime instance. |
| System.Char | dateTimeSeparator | Specifies a character that is used to separate the date and time part in the timestamp. |
| System.Boolean | addFractionalSeconds | If true, adds fractional seconds to the timestamp. |
| System.Boolean | addUtcOffset | If true, adds the offset to Coordinated Universal Time to the timestamp. |
Returns
| Type | Description |
|---|---|
| System.String | Returns the value of the current DateTime instance as a timestamp string. |