ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Date and time functions
  • YYYYMMDD format
  • Miscellaneous
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Converts an integer into a date in YYYYMMDD format.
Example
IntegerToDate(73773)       // Returns "20011225"
IntegerToDate(73773, "Y")  // Returns "2001"
IntegerToDate(73773, "M")  // Returns "12"
IntegerToDate(73773, "D")  // Returns "25"
 
// Calculate tomorrow's date
let Tomorrow = IntegerToDate(DateToInteger(DateSys()) + 1)
Syntax
<Result> = IntegerToDate(<Date> [, <Format>])
<Result>: Character string or Date variable
Date in YYYYMMDD format.
<Date>: Integer
Number of days elapsed since January 1st 1800 + 1 (January 1st 1800 is number 1).
<Format>: Optional character string
Format of the date to retrieve:
  • Y to retrieve the year in YYYY format,
  • M to retrieve the month in MM format,
  • D to retrieve the day in DD format.
If this parameter is not specified, the format used by default is YYYYMMDD (YYYY corresponds to the year, MM to the month and DD to the day).
Remarks

YYYYMMDD format

To get the date in a format other than YYYYMMDD, the string must be formatted using DateToString, Right, Left, etc.
The YYYYMMDD format was chosen because it allows you to check the order of dates. This would not be possible with a date in YYYYDDMM or DDMMYYYY format, for example.
WINDEVWEBDEV - Server codeReports and QueriesWindowsUniversal Windows 10 AppAndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystJavaUser code (UMC)Stored procedures

Miscellaneous

This function cannot be used to retrieve dates before October 14, 1582 (the change from the Julian to the Gregorian calendar will not be taken into account).
Business / UI classification: Neutral code
Component: wd290std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Data Fora Feriado?
PROCEDURE Rules_DataForaFeriado(gData)

bDataForaFeriado is boolean = True

HReset(T031_FERIADOS)
FOR EACH T031_FERIADOS
IF HFound(T031_FERIADOS) = True
IF T031_FERIADOS.T031_DIA = Middle(gData,7,2) AND T031_FERIADOS.T031_MES = Middle(gData,5,2) THEN
bDataForaFeriado = False
END
END
END

IF bDataForaFeriado = False THEN
Info("A data é um feriado!")
END

RESULT bDataForaFeriado
BOLLER
03 Apr. 2019
Exemplo: A data é invalida pois é um domingo!!!!
PROCEDURE Rules_DataValida(dDataValida)
bvalida is boolean = False
dataFormatada is Date
dataFormatada..Year = Middle(dDataValida,1,4)
dataFormatada..Month = Middle(dDataValida,5,2)
dataFormatada..Day = Middle(dDataValida,7,2)
dDataMinima is Date
dDataMinima = dataFormatada
dDataMinima..Year -= 5
dDataMaxima is Date
dDataMaxima = dataFormatada
dDataMaxima..Year += 5
IF dataFormatada >= dDataMinima AND
dataFormatada <= dDataMaxima AND
Lower(DateToDayInAlpha(dataFormatada)) <> "domingo" AND
Lower(DateToDayInAlpha(dataFormatada)) <> "sábado"
bvalida = True
ELSE
bvalida = False
IF Lower(DateToDayInAlpha(dataFormatada)) = "domingo" OR
Lower(DateToDayInAlpha(dataFormatada)) = "sábado"
Info("Data Inválida, é um "+DateToDayInAlpha(dataFormatada)) ////
ELSE
Info("Data Inválida")
END
END
RESULT bvalida
BOLLER
03 Apr. 2019

Last update: 05/26/2022

Send a report | Local help