Official Content

Stores Date values.

Scope

Generators: .NET.NET Framework, JavaAppleAndroid

Conversion by DBMS

The following table illustrates the conversion GeneXus performs according to the DBMS:

DBMS Conversion
Oracle DATE
DB2 Universal Database DATE
Informix DATE
SQL Server DATETIME
Access DBDate
DB2 for iSeries CHAR(8) or DATE1
DBF DATE(8,0)
PostgreSQL DATE

1 Depends on the value set for the Date data type definition property.

Pictures

Read about Pictures that can be applied to Date data types.


Static methods

The Date data type has two static method available only for the .NET, .NET Framework and Java generators.

New

Generates Date instances with specific values for the date.

Syntax

Date.New(Year,Month,Day)

Samples
&ExpirationDate = Date.New(2018,6,10)
If &ExpirationDate >= Date.New(2022,1,4)
   msg("The date has expired")
EndIf


Today

Gets the current system date.

Syntax

Date.Today()

Samples
&date = Date.Today(); 
&dateString = &date.ToString()
msg(&dateString) // 09/12/23

Consideration

When generating iOS code, controls based on the Date / DateTime data type, use the Date format property and Hour format property to infer the native styles dateStyle and timeStyle which take into account the user's preferences in the device settings.

See also

DateTime data type
Data types list

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant