# 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

### ![](/files/dBIrS7XBDGmrzmTRbSI6)SalDateTime(x)

Creates a new SalDateTime.

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

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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) |             |

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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) |             |

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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

### ![](/files/69uzLyEV3ANF4GK6pznb)Current

[SalDateTime](/ppj.runtime.49/types/ppj.runtime.saldatetime.md): Returns the PC's current date/time.

### ![](/files/dBIrS7XBDGmrzmTRbSI6)IsNull

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

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Ticks

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

### ![](/files/69uzLyEV3ANF4GK6pznb)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.

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Value

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

## Methods

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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](/ppj.runtime.49/types/ppj.runtime.saldatetime.md).

### ![](/files/69uzLyEV3ANF4GK6pznb)Compare(x, y)

Compares two SalDateTime

| Parameter | Type                                                            | Description |
| --------- | --------------------------------------------------------------- | ----------- |
| **x**     | [SalDateTime](/ppj.runtime.49/types/ppj.runtime.saldatetime.md) |             |
| **y**     | [SalDateTime](/ppj.runtime.49/types/ppj.runtime.saldatetime.md) |             |

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

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)CompareTo(x)

Compare to datetime

| Parameter | Type                                                            | Description |
| --------- | --------------------------------------------------------------- | ----------- |
| **x**     | [SalDateTime](/ppj.runtime.49/types/ppj.runtime.saldatetime.md) |             |

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

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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](/ppj.runtime.49/types/ppj.runtime.saldatetime.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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](/ppj.runtime.49/types/ppj.runtime.saldatetime.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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](/ppj.runtime.49/types/ppj.runtime.saldatetime.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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](/ppj.runtime.49/types/ppj.runtime.saldatetime.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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](/ppj.runtime.49/types/ppj.runtime.saldatetime.md). dtMonthBegin

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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](/ppj.runtime.49/types/ppj.runtime.saldatetime.md). nQuarter

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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](/ppj.runtime.49/types/ppj.runtime.saldatetime.md). dtQuarterBegin

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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](/ppj.runtime.49/types/ppj.runtime.saldatetime.md). nSeconds

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Subtract(x)

Subtract SalDateTime from SalDateTime.

| Parameter | Type                                                            | Description |
| --------- | --------------------------------------------------------------- | ----------- |
| **x**     | [SalDateTime](/ppj.runtime.49/types/ppj.runtime.saldatetime.md) |             |

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

### ![](/files/dBIrS7XBDGmrzmTRbSI6)ToDateTime()

Returns the DateTime value.

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

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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](/ppj.runtime.49/types/ppj.runtime.saldatetime.md). dtWeekBegin

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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](/ppj.runtime.49/types/ppj.runtime.saldatetime.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)Year()

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

**Returns:** [SalNumber](/ppj.runtime.49/types/ppj.runtime.saldatetime.md).

### ![](/files/dBIrS7XBDGmrzmTRbSI6)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](/ppj.runtime.49/types/ppj.runtime.saldatetime.md). dtYearBegin

## Used By

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://desktop-api.iceteagroup.com/ppj.runtime.49/types/ppj.runtime.saldatetime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
