PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Range of dates
  • Managing the days and months
  • Handling the durations
  • Operators available for the days
  • Calculating the last day of the month
  • Calculating a payment date at 90 days (end of month)
  • Calculating the end of a floating month
  • Calculations on dates
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
..Day is used to:
  • Retrieve the day from a Date, DateTime variable or retrieve the number of days from a Duration variable.
  • Modify the day in a Date or DateTime variable, or modify the number of days in a Duration variable.
  • Retrieve the day or the number of days from a Date item (in "Date", "Date and Time" or "Duration" format).
    WEBDEV - Browser code Not available.
  • Modify the day or the number of days in a Date item (in "Date", "Date and Time" or "Duration" format).
    WEBDEV - Browser code Not available.
Note: ..Day is used to simplify the operations performed on the dates (add one day, ...).
Reminder: The Date items are used to manage:
  • the simple dates "Year - Month - Day" (YYYYMMDD format)
  • the dates and times "Year - Month - Day - Hours - Minutes - Seconds - Milliseconds" (YYYYMMDDHHMMSSLLL format)
  • the durations "Number of days - Number of hours - Number of minutes - Number of seconds - Number of milliseconds" (+DHHMMSSLLL format)
Versions 16 and later
Universal Windows 10 App This property is now available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This property is now available for the Windows Phone applications.
Universal Windows 10 App This property is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This property is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This property is now available for the iPhone/iPad applications.
iPhone/iPad This property is now available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This property is now available in Windows Store Apps mode.
New in version 18
Universal Windows 10 App This property is now available in Windows Store Apps mode.
Universal Windows 10 App This property is now available in Windows Store Apps mode.
Versions 20 and later
WEBDEV - Browser code This property is now available in browser code for the Date, DateTime or Duration variables.
New in version 20
WEBDEV - Browser code This property is now available in browser code for the Date, DateTime or Duration variables.
WEBDEV - Browser code This property is now available in browser code for the Date, DateTime or Duration variables.
Versions 21 and later
Apple Watch This property is now available in Apple Watch mode.
Universal Windows 10 App This property is now available in Universal Windows 10 App mode.
New in version 21
Apple Watch This property is now available in Apple Watch mode.
Universal Windows 10 App This property is now available in Universal Windows 10 App mode.
Apple Watch This property is now available in Apple Watch mode.
Universal Windows 10 App This property is now available in Universal Windows 10 App mode.
Example
// Example on a variable
StartDate is Date = "20011225"
// Add 5 days to the date
StartDate..Day += 5
// Modify the days
StartDate..Day = 10
// Example on an item
Work.StartDate = "20011225"
// Add 5 days to the date
Work.StartDate..Day += 5
// Modify the days
Work.StartDate..Day = 10
Syntax

Finding out the day in a Date, DateTime or Duration variable Hide the details

<Result> = <Date>..Day
<Result>: Integer
Day on 2 digits.
<Date>: Date or DateTime
Name of the Date, DateTime or Duration variable to use.

Modifying the day in a Date, DateTime or Duration variable Hide the details

<Date>..Day = <New Day>
<Date>: Date or DateTime
Name of the Date, DateTime or Duration variable to use.
<New Day>: Integer or character string
New day in digits (included between 1 and 31). Replaces the day in the specified date.
WEBDEV - Browser code Not available in browser code

Finding out the day in a Date item Hide the details

<Result> = <File Name>.<Item Name>..Day
<Result>: Integer
Day on 2 digits.
<File Name>: Character string (with or without quotes)
Name of data file used. This name was defined in the data model editor or by the File Description type.
<Item Name>: Character string (with or without quotes)
Name of item used. This name was defined in the data model editor or by the Item Description type.
WEBDEV - Browser code Not available in browser code

Modifying the day in a Date item Hide the details

<File Name>.<Item Name>..Day = <New Day>
<File Name>: Character string (with or without quotes)
Name of data file used. This name was defined in the data model editor or by the File Description type.
<Item Name>: Character string (with or without quotes)
Name of item used. This name was defined in the data model editor or by the Item Description type.
<New Day>: Integer or character string
New day in digits (included between 1 and 31). Replaces the day in the specified date.
Remarks

Range of dates

The Date and DateTime types are used to manage the dates from 01/01/0001 to 31/12/9999.

Managing the days and months

Case 1: Direct assignment
During a direct assignment (for example, MyDay..Day = n), the day must be included between 1 and 31. A WLanguage error occurs if the specified day is incorrect.
The following syntax MyDay..Day = MyDay..Day + 5 may generate an error at run time. For example, the following code lines trigger an error:
// Code triggering the error
MyDate is Date = "20041126"   // 11/26/2004
MyDate..Day = MyDate..Day + 20   // Triggers a WLanguage error because the day is equal to 45

// Correct code
MyDate is Date = "20041126"   // 11/26/2004
MyDate..Day += 20

// Code triggering the error
MyDate is Date = "20041126"   // 11/26/2004
MyDate1 is Date
MyDate1..Day = MyDate..Day + 20   // Triggers a WLanguage error because the day is equal to 45

// Correct code
MyDate1 = MyDate   // 11/26/2004
MyDate1..Day += 20
Case 2: Operations on the days
When performing operations on the dates, the change of month is automatically managed. Therefore, if the number of days is greater than the number of days in the month, the number of days restarts from 1 and the number of the month is automatically modified. The year is also modified if necessary (month of December for instance).
For example:
StartDate is Date = "20041226"   // 12/26/2004
// Add 10 days to the date
StartDate..Day +=10    // StartDate is "20050105"

Handling the durations

A duration has no limit: the number of days can exceed 30 or 31 days.

Operators available for the days

The following arithmetic operators can be used by ..Day:
  • ++ and --
  • += and - =
StartDate is Date = "20041126"  
StartDate..Day++     // Add 1 day to the date
StartDate..Day+=5    // Add 5 days ot the date
StartDate..Day-=5    // Subtract 5 days to the date

Calculating the last day of the month

To find out the last day of a month, all you have to do is assign 31 to ..Day. The last day will be automatically calculated according to the specified month.
StartDate is Date = "20041126"  
StartDate..Day = 31    
// November does not have 31 days
// The day is automatically replaced by 30

Calculating a payment date at 90 days (end of month)

..Day is used to calculate the end date of a deadline at 90 days.
MyDate is Date = "20041126"  
MyDate..Day += 90    
MyDate..Day = 31

Calculating the end of a floating month

A floating month corresponds to a one-month period from a given date. ..Month and ..Day are used to easily calculate the end date of a floating month.
StartDate is Date = "20041126"  
EndDate is Date = StartDate
EndDate..Month++    
EndDate..Day--

Calculations on dates

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