Views:

Product: LABELVIEW, CODESOFT

Version: All Versions

 

BestBefore(«date», «dateFormat», «offset», «offsetUnit», «changeMonth», «outputFormat») calculates a Best Before date based on a specified input date rather than the current system date.

Function Parameters

ParameterTypeDescription
Return ValueStringA calculated date returned as a formatted string.
dateStringThe base date value in string format.
dateFormatString / NumberDefines the format of the base date.
  • Numeric values reference predefined formats.
  • 0 or negative values use the system date format.
  • String values define a custom format directly (for example: yyyy/mm/dd).
offsetNumberThe number of date units added to the base date.
offsetUnitString / NumberDefines the offset unit:
  • 1, "d", or "D" = Days
  • 2, "m", or "M" = Months
  • 3, "y", or "Y" = Years
changeMonthNumberOptional (Default = True)
  • 0 = False
  • 1 = True
If the calculated date does not exist in the target month:
  • True returns the first day of the following month.
  • False returns the last valid day of the target month.
outputFormatString / NumberOptional. If omitted, the output format matches the input date format. Supports the same values as dateFormat.

Predefined Date Formats

NumberDate Format
1dd/mm
2dd mmmm
3dd/mm/yy
4dd/mm/yyyy
5mm/dd
6mmmm dd
7mm/dd/yy
8mm/dd/yyyy
9mmm-yy
10mmmm-yy
11dd-mmm-yy
12dd-mmmm-yy
13d/m/yy
14dddd/m/yy
15ddddd/m/yy
16d/m/yyyy
17dd/mmmm/yyyy
18d mmmm yyyy
19ddddd dd mmm yyyy
20dd/mm/yy h:nn
21mm/dd/yy h:nn

Examples

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

Example Using a Date Variable

  • Create a date variable named date0 containing the current date (for example: 26/06/2012 in dd/mm/yy format).
  • BestBefore(date0, "dd/mm/yy", "18", "m", 1, "dd/mm/yyyy") returns the date 18 months after the value stored in date0.