# SalDateTime

Namespace: **PPJ.Runtime**

Assembly: **PPJ.Runtime.49** (4.9.0.0)

SAL Date/Time basic type. It wraps .NET native DateTime type. SalDateTime objects are automatically cast to and from DateTime.

{% tabs %}
{% tab title="C#" %}

```csharp
public struct SalDateTime : ValueType, IComparable, IConvertible, IFormattable, INullable, ISalType, IXmlSerializable
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Structure SalDateTime
    Implements ValueType, IComparable, IConvertible, IFormattable, INullable, ISalType, IXmlSerializable
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)SalDateTime(x)

Creates a new SalDateTime.

| Name  | Type                                                                    | Description            |
| ----- | ----------------------------------------------------------------------- | ---------------------- |
| **x** | [DateTime](https://docs.microsoft.com/en-us/dotnet/api/system.datetime) | DateTime initial value |

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)SalDateTime(year, month, day)

Create a new SalDateTime

| Name      | Type                                                              | Description |
| --------- | ----------------------------------------------------------------- | ----------- |
| **year**  | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **month** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **day**   | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)SalDateTime(year, month, day, hour, minute, second)

Create a new SalDateTime

| Name       | Type                                                              | Description |
| ---------- | ----------------------------------------------------------------- | ----------- |
| **year**   | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **month**  | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **day**    | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **hour**   | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **minute** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **second** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)SalDateTime(year, month, day, hour, minute, second, milliseconds)

Create a new SalDateTime

| Name             | Type                                                              | Description |
| ---------------- | ----------------------------------------------------------------- | ----------- |
| **year**         | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **month**        | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **day**          | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **hour**         | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **minute**       | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **second**       | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |
| **milliseconds** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) |             |

## Properties

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media)Current

[SalDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime): Returns the PC's current date/time.

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)IsNull

[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean): Checks if this SalDateTime object contain a null value.

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Ticks

[Int64](https://docs.microsoft.com/en-us/dotnet/api/system.int64): Returns the number of ticks.

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media)TreatMinValueAsNull

[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean): Gets or sets a property that enables the automatic conversion of DateTime.MinValue SalDateTime.Null.

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Value

[DateTime](https://docs.microsoft.com/en-us/dotnet/api/system.datetime): Returns the inner DateTime value

## Methods

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)AddDays(days)

Add days or fraction of days to the date.

| Parameter | Type                                                                | Description |
| --------- | ------------------------------------------------------------------- | ----------- |
| **days**  | [Double](https://docs.microsoft.com/en-us/dotnet/api/system.double) |             |

**Returns:** [SalDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime).

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media)Compare(x, y)

Compares two SalDateTime

| Parameter | Type                                                                                            | Description |
| --------- | ----------------------------------------------------------------------------------------------- | ----------- |
| **x**     | [SalDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime) |             |
| **y**     | [SalDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime) |             |

**Returns:** [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32).

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)CompareTo(obj)

Compare to object

| Parameter | Type                                                                | Description |
| --------- | ------------------------------------------------------------------- | ----------- |
| **obj**   | [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) |             |

**Returns:** [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32).

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)CompareTo(x)

Compare to datetime

| Parameter | Type                                                                                            | Description |
| --------- | ----------------------------------------------------------------------------------------------- | ----------- |
| **x**     | [SalDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime) |             |

**Returns:** [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32).

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Day()

Returns the day portion (1 to 31) of a date/time value or returns -1 if you specify DATETIME\_Null as a parameter.

**Returns:** [SalNumber](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime).

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Hour()

Returns the hour portion (0 to 23) of a date/time value or returns -1 if you specify DATETIME\_Null as a parameter.

**Returns:** [SalNumber](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime).

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Minute()

Returns the minute portion (0 to 59) of a date/time value or returns -1 if you specify DATETIME\_Null as a parameter.

**Returns:** [SalNumber](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime).

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Month()

Returns the month portion (1 to 12) of a date/time value or returns -1 if you specify DATETIME\_Null as a parameter.

**Returns:** [SalNumber](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime).

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)MonthBegin()

Returns the date of the first day of the month or it returns DATETIME\_Null if the value you specify is null. For example, if dtDateTime is December 25, 1992, SalDateMonthBegin returns December 1, 1992.

**Returns:** [SalDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime). dtMonthBegin

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Quarter()

Returns the quarter of the year (1 to 4) of a date/time value or returns -1 if you specify DATETIME\_Null as a parameter.

**Returns:** [SalNumber](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime). nQuarter

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)QuarterBegin()

Returns the date of the first day of the quarter of a date/time value or it returns DATETIME\_Null if the value you specify is null.

**Returns:** [SalDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime). dtQuarterBegin

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Second()

Returns the seconds portion (0 to 59) of a date/time value or returns -1 if you specify DATETIME\_Null as a parameter.

**Returns:** [SalNumber](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime). nSeconds

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Subtract(x)

Subtract SalDateTime from SalDateTime.

| Parameter | Type                                                                                            | Description |
| --------- | ----------------------------------------------------------------------------------------------- | ----------- |
| **x**     | [SalDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime) |             |

**Returns:** [Double](https://docs.microsoft.com/en-us/dotnet/api/system.double).

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)ToDateTime()

Returns the DateTime value.

**Returns:** [DateTime](https://docs.microsoft.com/en-us/dotnet/api/system.datetime).

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)WeekBegin()

Returns the date of the previous Monday or the current day if it is a Monday or it returns DATETIME\_Null if the value you specify is null.

**Returns:** [SalDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime). dtWeekBegin

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Weekday()

Returns the day of the week as a number between 0 and 6 or returns -1 if you specify DATETIME\_Null as a parameter. 0 represents Saturday, 1 represents Sunday, and so on.

**Returns:** [SalNumber](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime).

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Year()

Returns the year portion of a date or returns -1 if you specify DATETIME\_Null as a parameter.

**Returns:** [SalNumber](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime).

### ![](https://299326270-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7qefdGDqaAibSgFIaGI0%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)YearBegin()

Returns the date of the first day of the year or it returns DATETIME\_Null if the value you specify is null.

**Returns:** [SalDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime). dtYearBegin

## Used By

| Name                                                                                                           | Description                                                                                                                                 |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| [Sal.DateYear](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)               | Returns the year portion of a date or returns -1 if you specify DATETIME\_Null as a parameter.                                              |
| [Sal.DateYearBegin](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)          | Returns the date of the first day of the year or it returns DATETIME\_Null if the value you specify is null.                                |
| [SalDateTime.Current](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)        | Returns the PC's current date/time.                                                                                                         |
| [SalDateTime.WeekBegin](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)      | Returns the date of the previous Monday or the current day if it is a Monday or it returns DATETIME\_Null if the value you specify is null. |
| [SalFileHandle.SetDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)  | Sets the modification date and time of the specified file.                                                                                  |
| [SalString.ToDate](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)           | Converts a string to a date/time value.                                                                                                     |
| [SalSafeArray.PutDate](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)       | Stores a DateTime item in the safearray.                                                                                                    |
| [SalSafeArray.PutDate2D](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)     |                                                                                                                                             |
| [SalSafeArray.PutDateMD](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)     | Multidimensional safe array                                                                                                                 |
| [SalVariant.SetDate](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)         |                                                                                                                                             |
| [SalDataField.DateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)      | DateTime value property.                                                                                                                    |
| [SalTableColumn.DateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)    | DateTime value property.                                                                                                                    |
| [Vis.TblFindDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)        |                                                                                                                                             |
| [Vis.FileSetDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)        |                                                                                                                                             |
| [Vis.ArrayFillDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)      |                                                                                                                                             |
| [Vis.ArrayFindDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)      |                                                                                                                                             |
| [VisCalendar.IsSelectedDate](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime) |                                                                                                                                             |
| [VisCalendar.SetFocusDate](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)   |                                                                                                                                             |
| [VisCalendar.SelectDate](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)     |                                                                                                                                             |
| [VisCalendar.SetSpecialDate](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime) |                                                                                                                                             |
| [VisCalendar.IsSpecialDate](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)  |                                                                                                                                             |
| [VisCalendarDropDown.Value](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)  |                                                                                                                                             |
| [XSal.ZipCreateFile](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)         |                                                                                                                                             |
| [XSal.StrFormatDateTime](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)     |                                                                                                                                             |
| [XSal.StrFormatDateTimeX](https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime)    |                                                                                                                                             |
