Views:

Product: LABELVIEW, CODESOFT

Version: All Versions

 

BestBefore(«date» , «dateFormat» , «offset» , «offsetUnit» , «changeMonth» , «outputFormat»): Allows you to calculate a Best Before date based on keyboard input value (not based on current date).

 

Return value

String

A date value in string format, calculated by a base date and an offset. 

date

String

Base date value in string format.

dateFormat

String / Number

Format of the base date value.
- Numbers encode predefined formats. (For example, 1"dd/mm", 2 "dd mmmm" and so on).
-  0 or negative values mean using the current system date format.
- String value encode the format directly. (For example, "yyyy/mm/dd")

offset

Number

Number of date units to be added to the base date.

offsetUnit

String / Number

Meaning of the offset parameter.
- 1 or "d" or "D" means days.
- 2 or "m" or "M" means months.
- 3 or "y" or "Y" means years.

changeMonth

Number

Optional (Default: True)
- 0 means False.
- 1 means True.
If calculated date does not exist in the month (For example, 30 of February).
True return the first day in the next month (For example, 1st March).
False return the last day in the current month (For example, 28 of February).

outputFormat

String / Number

Optional (Default: same as dateFormat)
This parameter specifies the output format of the calculated date.
Possible values are the same as in case of dateFormat.

 

Number

Date Format

1

"dd/mm"

2

"dd mmmm"

3

"dd/mm/yy"

4

"dd/mm/yyyy"

5

"mm/dd"

6

"mmmm dd"

7

"mm/dd/yy"

8

"mm/dd/yyyy"

9

"mmm-yy"

10

"mmmm-yy"

11

"dd-mmm-yy"

12

"dd-mmmm-yy"

13

"d/m/yy"

14

"dddd/m/yy"

15

"ddddd/m/yy"

16

"d/m/yyyy"

17

"dd/mmmm/yyyy"

18

"d mmmm yyyy"

19

"ddddd dd mmm yyyy"

20

"dd/mm/yy h:nn"

21

"mm/dd/yy h:nn"


Example:
  • BestBefore («date» , «dateFormat» , «offset» , «offsetUnit» , «changeMonth» , «outputFormat»)
  • BestBefore("14/06/2012" ,"dd/mm/yyyy","18","m", 1, "dd/mm/yyyy") will return 14/12/2013.

Example: Formula with a date data source.
  • Create a date variable name date0 with the date of the day, for example 26/06/2012 (dd/mm/yy format).
  • BestBefore(date0 ,"dd/mm/yy","18","m", 1, "dd/mm/yyyy") will return 14/12/2013.