- Relative duration: modifying the available captions
- Format of masks to use
Configuring the "Relative duration" mask (date and time in natural language)
WINDEV, WEBDEV and WINDEV Mobile propose to use a "Relative duration" display mask for the Date controls. This mask is used to display the duration between the data found in the control and today's date in natural language: yesterday, tomorrow, one week ago, in one month, ...
This feature is now available for the Java applications.
This feature is now available for the Android applications.
This feature is now available in Android Widget mode.
This "RelativeDuration" mask is also available in programming via DateToString
The caption used by the "Relative duration" mask can be configured for each language used by the application.
To configure the caption used:
- On the "Project" pane, in the "Project" group, click "Description".
- In the "Languages" tab:
- select the language to configure.
- select the "Date" tab.
- Click the "Dates and Times in natural language" button.
- Define the custom captions to use.
Relative duration: modifying the available captions
A default caption is indicated for each specified period. This caption is used as soon as the "Relative duration" mask is used.
The default mask can be modified for each period: to do so, enter the new mask in the "Custom caption" column.
Format of masks to use
The format of the masks can contain two types of information:
- A standard date: to do so, the following elements allow you to define a custom mask:
|'DDDD'||Corresponding day of the week, "Thursday" for example. The case used depends on the linguistic options of project.|
|'Dddd'||Corresponding day of the week with the first letter forced in uppercase, for example: Monday.|
|'dddd'||Corresponding day of the week with the first letter forced in lowercase, for example: Monday.|
|'DDD'||Abbreviated day of the week, "Fri" for example|
|'Ddd'||Abbreviated day of the week with the first letter forced inn uppercase, for example: Mon|
|'ddd'||Abbreviated day of the week with the first letter forced inn lowercase, for example: mon|
|'DD'||Date in digits, "25" for example|
|'MMMM'||Month in full, "January" for example. The case used depends on the linguistic options of project.|
|'Mmmm'||Month in full with the first letter forced in uppercase, for example: January.|
|'mmmm'||Month in full with the first letter forced in lowercase, for example: january.|
|'MMM'||Abbreviation of the month, "Jan" for example.|
|'Mmm'||Abbreviation of the month with the first letter forced in uppercase, for example: Jan.|
|'mmm'||Abbreviation of the month with the first letter forced in lowercase, for example: jan.|
|'MM'||Month in digits, "06" for example|
|'YYYY'||Year on four digits, "2001" for example|
|'AA'||Two last digits of the year, "01" for example|
|'HH'||Hour in digits, "13" for example|
|'mm'||Minutes in digits, "32" for example|
|'SS'||Seconds in digits, "46" for example|
- An amount of time elapsed between the current date and time and the given date and time. The following masks are used for this format:
|RYY||Returns the number of years passed|
|RMM||Returns the number of months passed|
|RWW||Returns the number of weeks passed|
|RDD||Returns the number of days passed.|
|RHH||Returns the number of hours passed.|
|Rmm||Returns the number of minutes passed.|
|RSS||Returns the number of seconds passed|
Caution: For accuracy reasons, only two nearest formats will be accepted. The other formats are not modified.
The possible information couples are:
- Years / Months
- Months / Weeks
- Weeks / Days
- Days / Hours
- Hours / Minutes
- Minutes / Seconds
Specifying 2 types of information increases the accuracy of the values.
If a single information is specified, the difference years/months/weeks/days are defined according to the calendar:
- Two years are passed between 12/31/2012 and 01/01/2014.
- Two months are passed between 12/31/2012 and 02/01/2013.
- Two days are passed between 10/10/2012 at 23:59 and 10/12/2012 at 00:00.
If two types of information are specified, the years/months/weeks/days are defined more precisely:
- A year is equivalent to a full year, which means from MM/DD/YYYY to MM/DD/YYYY+1
- A month is equivalent to a full month, which means from DD/MM to DD/MM+1
- A week is equivalent to 7 days, which means from DD at HH:mm:SS at DD+7 at HH:mm:SS
- A day is equivalent to a full day, which means from DD at HH:mm:SS to DD+1 at HH:mm:SS
This page is also available for…
Click [Add] to post a comment