ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage properties / Time and date management properties
  • Operators available for the years
  • Leap years
  • Calculations on dates
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The Year property is used to:
Note: The Year property can be used to simplify date shifting operations, such as adding a year.
Reminder Date fields and variables can be used to manage:
  • simple dates: "Year - Month - Day" (YYYYMMDD format).
  • dates and times: "Year - Month - Day - Hours - Minutes - Seconds - Milliseconds" (YYYYMMDDHHmmSSCCC format).
  • durations: "Number of days - Number of hours - Number of minutes - Number of seconds - Number of milliseconds" (+DHHMMSSCCC format).
Example
DateDébut is Date = DateSys()
// Ajouter 1 an à la date
DateDébut.Year++
// Modifier les années
DateDébut.Year = 2023
Syntax

Getting the year of a Date or DateTime variable or item Hide the details

<Result> = <Date>.Year
<Result>: entier
4-digit year.
<Date>: Date or DateTime
Name of the Date or DateTime variable or item to be used.
Apple Watch Only Date or DateTime variables can be used.

Changing the year of a Date or DateTime variable or item Hide the details

<Date>.Year = <New year>
<Date>: Date or DateTime
Name of the Date or DateTime variable or item to be used
Apple Watch Only Date or DateTime variables can be used.
<New year>: Integer or character string
New year in digits (between 1 and 9999). Replaces the year of the specified date.
Remarks

Operators available for the years

The following arithmetic operators can be used with the Year property:
  • ++ and --
  • += and -=
DateDébut is Date = "20231212"
DateDébut.Year++  // Ajouter 1 an à la date
DateDébut.Year+=5 // Ajouter 5 ans à la date
DateDébut.Year-=5 // Retrancher 5 ans à la date

Leap years

If the date handled corresponds to February 29 of a leap year, adding or subtracting a year also changes the day. For example:
DateDébut is Date = "20230229"
// Ajouter 1 an à la date
DateDébut.Year++ 
// DateDébut vaut "20240228"

Calculations on dates

The date storage format allows you to store dates from 01/01/0001 to 12/31/9999.
WLanguage functions and WLanguage properties make accurate calculations on dates from January 1st, 1583.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/13/2025

Send a report | Local help