Class

# DBKit.DateTimeLabel

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Displays the value of a single database column for the current row as a formatted date and time.

Set `ColumnName<dbkit.datetimelabel.columnname>` to the column you want the label bound to. When the current row changes, the label shows the column's date and time value, formatted using the `CustomFormat<dbkit.datetimelabel.customformat>`, `DateFormat<dbkit.datetimelabel.dateformat>` and `TimeFormat<dbkit.datetimelabel.timeformat>` properties.

Only the members declared by <span class="title-ref">DBKit.DateTimeLabel</span> and those inherited from <span class="title-ref">DBKit.Label</span> are described here; for the remaining inherited members, see `DesktopLabel</api/user_interface/desktop/desktoplabel>` (desktop) and `WebLabel</api/user_interface/web/weblabel>` (web).

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                           | Type                                                   | Read-Only | Shared |
|----------------------------------------------------------------|--------------------------------------------------------|-----------|--------|
| `ColumnName<dbkit.datetimelabel.columnname>`                   | `String</api/data_types/string>`                       |           |        |
| `CustomFormat<dbkit.datetimelabel.customformat>`               | `String</api/data_types/string>`                       |           |        |
| `DateFormat<dbkit.datetimelabel.dateformat>`                   | `DateTimeFormats<dbkit.datetimelabel.datetimeformats>` |           |        |
| `DefaultToNow<dbkit.datetimelabel.defaulttonow>`               | `Boolean</api/data_types/boolean>`                     |           |        |
| `DisplayName<dbkit.datetimelabel.displayname>`                 | `String</api/data_types/string>`                       |           |        |
| `FourDigitYear<dbkit.datetimelabel.fourdigityear>`             | `Boolean</api/data_types/boolean>`                     |           |        |
| `InvalidValueMessage<dbkit.datetimelabel.invalidvaluemessage>` | `String</api/data_types/string>`                       |           |        |
| `Mandatory<dbkit.datetimelabel.mandatory>`                     | `Boolean</api/data_types/boolean>`                     |           |        |
| `TimeFormat<dbkit.datetimelabel.timeformat>`                   | `DateTimeFormats<dbkit.datetimelabel.datetimeformats>` |           |        |
| `Value<dbkit.datetimelabel.value>`                             | `DateTime</api/data_types/datetime>`                   |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                       | Parameters | Returns                          | Shared |
|--------------------------------------------|------------|----------------------------------|--------|
| `TableName<dbkit.datetimelabel.tablename>` |            | `String</api/data_types/string>` |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                 | Parameters                                   | Returns |
|------------------------------------------------------|----------------------------------------------|---------|
| `RowChanged<dbkit.datetimelabel.rowchanged>`         | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowCreated<dbkit.datetimelabel.rowcreated>`         | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowDeleted<dbkit.datetimelabel.rowdeleted>`         | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowEditing<dbkit.datetimelabel.rowediting>`         | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowLoaded<dbkit.datetimelabel.rowloaded>`           | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowNotSelected<dbkit.datetimelabel.rownotselected>` |                                              |         |
| `RowSaved<dbkit.datetimelabel.rowsaved>`             | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowSaving<dbkit.datetimelabel.rowsaving>`           | row As `DBKit.Row</api/databases/dbkit/row>` |         |
| `RowUndone<dbkit.datetimelabel.rowundone>`           | row As `DBKit.Row</api/databases/dbkit/row>` |         |

## Enumerations

<div id="dbkit.datetimelabel.datetimeformats">

<div class="rst-class">

forsearch

</div>

</div>

DBKit.DateTimeLabel.DateTimeFormats

### DateTimeFormats

> Specifies the format of the date or time portion of the displayed value when `CustomFormat<dbkit.datetimelabel.customformat>` is blank. Each value corresponds to the same-named value of `DateTime.FormatStyles<datetime.formatstyles>`.
>
> | Formats |
> |---------|
> | None    |
> | Short   |
> | Medium  |
> | Long    |
> | Full    |
>
> None omits the date or time portion entirely.

## Property descriptions

<div id="dbkit.datetimelabel.columnname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.ColumnName

**ColumnName** As `String</api/data_types/string>`

> The name of the database column whose value this control displays.
>
> If blank, the control's name is used as the column name. The name may be qualified with a table name (for example "tablename.columnname") when the control shows a column from a related table.
>
> <div class="tip">
>
> <div class="title">
>
> Tip
>
> </div>
>
> Instead of setting this property, you can name the control the same as the database column. DBKit first looks at the ColumnName property; if it is blank, it then uses the name of the control itself.
>
> </div>

<div id="dbkit.datetimelabel.customformat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.CustomFormat

**CustomFormat** As `String</api/data_types/string>`

> A custom format string used to display the value. The string is passed to `DateTime.ToString<datetime.tostring>` with the current locale.
>
> If blank, the value is displayed using the `DateFormat<dbkit.datetimelabel.dateformat>` and `TimeFormat<dbkit.datetimelabel.timeformat>` properties instead.

<div id="dbkit.datetimelabel.dateformat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.DateFormat

**DateFormat** As `DateTimeFormats<dbkit.datetimelabel.datetimeformats>`

> The format used for the date portion of the displayed value when `CustomFormat<dbkit.datetimelabel.customformat>` is blank.
>
> The default is DateTimeFormats.None.

<div id="dbkit.datetimelabel.defaulttonow">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.DefaultToNow

**DefaultToNow** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, the `Value<dbkit.datetimelabel.value>` is set to the current date and time when a new row is created.
>
> The default is `False</api/language/false>`.

<div id="dbkit.datetimelabel.displayname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.DisplayName

**DisplayName** As `String</api/data_types/string>`

> A user-friendly name for the control, shown to the user in place of the column name (for example in the `InvalidValueMessage<dbkit.datetimelabel.invalidvaluemessage>`).
>
> If blank, the column name is de-camelcased automatically (for example "FirstName" becomes "First Name").

<div id="dbkit.datetimelabel.fourdigityear">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.FourDigitYear

**FourDigitYear** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, the year is displayed using four digits.
>
> The default is `True</api/language/true>`.

<div id="dbkit.datetimelabel.invalidvaluemessage">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.InvalidValueMessage

**InvalidValueMessage** As `String</api/data_types/string>`

> The message displayed when the field is mandatory but has no value. Use \<\$1\> as a placeholder for the control's display name.
>
> The default is "\<\$1\> must have a value."

<div id="dbkit.datetimelabel.mandatory">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.Mandatory

**Mandatory** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, the field must contain a value before the row can be saved. When a row with an empty mandatory field is saved, the `InvalidValueMessage<dbkit.datetimelabel.invalidvaluemessage>` is displayed and the save is cancelled.
>
> The default is `False</api/language/false>`.

<div id="dbkit.datetimelabel.timeformat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.TimeFormat

**TimeFormat** As `DateTimeFormats<dbkit.datetimelabel.datetimeformats>`

> The format used for the time portion of the displayed value when `CustomFormat<dbkit.datetimelabel.customformat>` is blank.
>
> The default is DateTimeFormats.None.

<div id="dbkit.datetimelabel.value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.Value

**Value** As `DateTime</api/data_types/datetime>`

> The date and time value displayed by the control.
>
> Setting Value updates the displayed text: if `CustomFormat<dbkit.datetimelabel.customformat>` is set, it determines the display; otherwise the `DateFormat<dbkit.datetimelabel.dateformat>` and `TimeFormat<dbkit.datetimelabel.timeformat>` properties do. Assigning `Nil</api/language/nil>` is ignored.

## Method descriptions

<div id="dbkit.datetimelabel.tablename">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.TableName

**TableName**() As `String</api/data_types/string>`

> Returns the name of the database table the control's column belongs to, resolved from the control's layout.

## Event descriptions

<div id="dbkit.datetimelabel.rowchanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.RowChanged

**RowChanged**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The current row (passed to the event) has been changed.

<div id="dbkit.datetimelabel.rowcreated">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.RowCreated

**RowCreated**(row As `DBKit.Row</api/databases/dbkit/row>`)

> A new row (passed to the event) was just created and is now the current row.

<div id="dbkit.datetimelabel.rowdeleted">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.RowDeleted

**RowDeleted**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The current row (passed to the event) has been deleted.

<div id="dbkit.datetimelabel.rowediting">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.RowEditing

**RowEditing**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The current row (passed to the event) is being edited by the user.

<div id="dbkit.datetimelabel.rowloaded">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.RowLoaded

**RowLoaded**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The current row (passed to the event) has been loaded.

<div id="dbkit.datetimelabel.rownotselected">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.RowNotSelected

**RowNotSelected**

> There is no row currently selected.

<div id="dbkit.datetimelabel.rowsaved">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.RowSaved

**RowSaved**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The current row (passed to the event) has been saved.

<div id="dbkit.datetimelabel.rowsaving">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.RowSaving

**RowSaving**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The current row (passed to this event) is about to be saved.

<div id="dbkit.datetimelabel.rowundone">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.DateTimeLabel.RowUndone

**RowUndone**(row As `DBKit.Row</api/databases/dbkit/row>`)

> The changes made to the current row (passed to this event) have been undone.

## Notes

#### Localization

Localize the control's user-facing text (`InvalidValueMessage<dbkit.datetimelabel.invalidvaluemessage>`) the standard Xojo way: assign a dynamic constant to each property and provide translations for as many languages as you need, or localize the property values directly.

## Compatibility

|                       |              |
|-----------------------|--------------|
| **Project Types**     | Desktop, Web |
| **Operating Systems** | All          |

<div id="dbkit.datetimelabel.seealso">

<div class="seealso">

`DBKit.Label</api/databases/dbkit/label>` parent class; `DBKit.Row</api/databases/dbkit/row>` class.

</div>

</div>
