Simplicty and flexibility!


Function::DateTime

Date
date(06,28,12)
date(MONTH,DAY,YEAR)
date(MM,DD,YY)
date(MyMonthField,MyDayField,MyYearField)


The date function constructs a DataEase date value from three separate numeric values. You can use constants, fields, functions or derivations to deduct the values.

If any input value is invalid (e.g., month > 12 or day > 31), DataEase calculates a future date, for example, 6,45,95 becomes 07/15/95 

Decimal values are automatically truncated.


Parameters


MONTH

is the number of the month (1-12),

DAY

is the day of month (1-31), and

YEAR

is the last two digits of year, or the full four digit year, depending on the type of date field.


Returns/Result


A datevalue in the Short Date format specified in the Windows Control Panel. For example, if you specify the United Kingdom default date format in Control Panel, the date value is returned in the order DD/MM/YY.

Examples


Example 1


date(7,1,99)

Returns:07/01/99

Example 2


FIRSTDAY:=date(month(TODAY), 1, year(TODAY));

LASTDAY:=date((month(TODAY)+1), 1, year(TODAY))-1.


This portion of ascriptuses avariablenamed TODAY (which holds the current date) and two other datefunctions, month and year, to find the first and last days of the current month.

The result, if the current date is July 4th, 1995, is: FIRSTDAY = 07/01/2001 LASTDAY = 07/31/01 This routine is accurate for any date.


Note: If your system is configured for an international date format other than United States, the date value may be returned in the order DD/MM/YY or YY/MM/DD. See your Microsoft Windows documentation to find the date format that corresponds to your Windows Control Panel country setting.

Regardless of how your system is configured, the three numerical values this function requires are always input in the order MONTH, DAY, YEAR.


Reference

Home>DQL Guide>DQL Lexicon> date

date

Type

Date Function

Purpose

The datefunctionconstructs a datevaluefrom three separate numericvalues.

Syntax

date(MONTH, DAY, YEAR)

?where;

MONTHis the number of the month (1-12),

DAYis the day of month (1-31), and

YEARis the last two digits of year, or the full four digit year, depending on the type of date field.

Returns

A datevaluein the Short Date format specified in theWindows Control Panel. For example, if you specify the United States default date format in Control Panel, the datevalueis returned in the order MM/DD/YY.

Usage

If any inputvalueis invalid (e.g., month > 12 or day > 31), DataEase calculates a future date, for example, 6,45,95 becomes 07/15/95 

Decimalvaluesare automatically truncated.

Example 1

date(7,1,99)

Returns:07/01/99

Example 2

FIRSTDAY:=date(month(TODAY), 1, year(TODAY));

LASTDAY:=date((month(TODAY)+1), 1, year(TODAY))-1.

This portion of ascriptuses avariablenamed TODAY (which holds the current date) and two other datefunctions, month and year, to find the first and last days of the current month.

The result, if the current date is July 4th, 1995, is: FIRSTDAY = 07/01/2001 LASTDAY = 07/31/01 This routine is accurate for any date.

Note: If your system is configured for an international date format other than United States, the datevaluemay be returned in the order DD/MM/YY or YY/MM/DD. See your Microsoft Windows documentation to find the date format that corresponds to yourWindows Control Panelcountry setting.

Regardless of how your system is configured, the three numericalvaluesthisfunctionrequires are always input in the order MONTH, DAY, YEAR.


See Also


Day
Month
Year

On the forum about Date

[@EOF@]...

Product: . Written by alembagheri tahmas 07/12/13 at 13:37:32

Hi there,I am trying to use an external MySQL DB in dataease. I have successfully create the ODBC link and added the DB to dataease. I can also access the DB from dataease. Now, just for testing purposes, I am trying to create a simple report b...

Product: DataEase for Windows 7.x. Written by George Washington 11/04/14 at 08:26:17

no se pude exportar ahora archivos a pdf, ni a excel o otros cosa mala. en verdad creo que hace faltaen las versiones anteriores me funcionaba mas o menos bien. le hace falta a los aplicativos que se desarrollan en Dataeasegr...

Product: DataEase 8 Reporter. Written by eduardo paez 02/05/14 at 14:40:11

Thanks. Anyway I'm trying to use this fuction but it seems to me that it doesn't work on 8.2. I tried also in a DQL.There's something wrong?<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA9IAAAJ3CAYAAAB4NWk3AAAAAXNSR0IArs4...

Product: . Written by Marco Marchesi 15/02/16 at 14:50:46

[@EOF@]...

Product: Dataease [{8}]FIVE. Written by Chamil Rajindra 21/02/19 at 10:17:46

Thanks for the very good explanation!AS...

Product: . Written by afonso santos 28/10/19 at 00:50:14

I am pleased to see that the migration from Dos 4.53 is then sa 5.5 works. A really useful thing would be a compiler of SQL languages. Will you get there?Original Text:Mi compiaccio a vedere che la migrazione da Dos 4.53 รจ poi sa 5.5 funzio...

Product: . Written by Grossi Gioacchino 18/11/19 at 14:33:44

How can i delete a Style sheet?...

Product: Dataease [{8}]FIVE. Written by Rainer 22/03/21 at 11:13:10

I run W7 and since a few days&nbsp;Dataease 8.5 is not starting any more, do you have an idea? i installed it again but that did not help....

Product: Dataease [{8}]FIVE. Written by Rainer 08/06/21 at 14:12:40

[@EOF@]...

Product: . Written by Hiralal Rampul 01/12/21 at 17:47:10

On the blog about Date


dg3_HelpView