Skip to main content

Date functions

A date can be specified either with four digits for the year, two digits for the month, and two digits for the day or with two digits for the year, two digits for the month, and two digits for the day.

For text-type data, specify data with forward slashes between each value, such as YYYY/MM/DD or YY/MM/DD.

For date-type data, specify data with the year, month, and day in a row, such as YYYYMMDD or YYMMDD.

Restriction

  • To use text-type data for date-type arguments in date functions, the data type must be converted using CTOD.

  • "SEI2WA", "SEI2WA1", "SEI2WA1Z", "WA2SEI", "NENGO", and "WYEAR" can only be used in Japanese forms.

  • "DATE", "IDATE", and "WA2SEI" do not support two-digit years.

Function name

Feature

DTOC

Converts date-type data (YYYYMMDD) into text-type data (YYYY/MM/DD).

DATE

Retrieves the system date.

IDATE

Retrieves the system date.

CTOD

Converts text-type data (YYYY/MM/DD) into date-type data (YYYYMMDD).

CDOW

Retrieves the name of the day of the week as text-type data from date-type data (YYYYMMDD).

ADATE

Adds (or subtracts) the specified number of days to (or from) a date, and retrieves the result as date-type data (YYYYMMDD).

YEAR

Retrieves only the Western calendar year as numeric-type data from date-type data (YYYYMMDD).

WYEAR

Retrieves only the Japanese calendar year as numeric-type data from date-type data (YYYYMMDD).

MONTH

Retrieves only the month as numeric-type data from date-type data (YYYYMMDD).

MONTH2

Retrieves only the month as text-type data from date-type data (YYYYMMDD).

DAY

Retrieves only the day as numeric-type data from date-type data (YYYYMMDD).

DOW

Calculates the day of the week from date-type data (YYYYMMDD) and retrieves the corresponding numeric-type data.

CDATE

Calculates the number of days within the period and retrieves the result as numeric-type data.

SEI2WA / SEI2WA1 / SEI2WA1Z

Converts the Western calendar date-type data to the Japanese calendar date, and retrieves the result as text-type data.

WA2SEI

Converts the Japanese calendar text-type data to the Western calendar date, and retrieves the result as date-type data.

NENGO

Retrieves the Era name of the Japanese calendar (era) from Western calendar date-type data.

DTOC

Feature

Converts date-type data (YYYYMMDD) into text-type data (YYYY/MM/DD).

Format

DTOC(date_data)

Settings

  1. In "date_data", specify the date-type data (or text-type data) to convert, or the name of the field that contains the data.

  2. This will convert the data in "date_data" into text-type data.

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When converting date-type data from the field "S1" into text-type data "YYYY/MM/DD", and outputting to the text field "S2"

    • Edit-formula: DTOC(S1)

    • Printing result: "2005/01/10"

  • Example 2: When converting date-type data from the field "S1" into text-type data "YYYY/MM/DD", and using as the value of the text field "S2"

    • Calculation-formula: DTOC(S1)

    • Printing result: "2005/01/10"

  • Example 3: When converting the system date into text-type data "YYYY/MM/DD", and outputting to the text field "S2"

    • Edit-formula: DTOC(DATE())

    • Printing result: "2005/01/10"

DATE

Feature

Retrieves the system date.

Format

DATE()

Settings

This will retrieve the system date at the time of printing (when the DATE function is executed) as date-type data (YYYYMMDD).

Usage examples

  • Example 1

    When converting the system date into date-type data "YYYYMMDD", and outputting to the text field "S2"

    When converting the system date into date-type data "YYYYMMDD", and outputting to the numeric field "I2"

    • Edit-formula: DATE()

    • Printing result

      Text field "S2": 20050110

      Numeric field "I2": 20050110

  • Example 2: When converting the system date into date-type data "YYYYMMDD", using the value of the text field "S2" and the numeric field "I2"

    • Calculation-formula

      Text field "S2": DATE()

      Numeric field "I2": VAL(DATE())

    • Printing result

      Text field "S2": 20050110

      Numeric field "I2": 20050110

  • Example 3: When the system date is retrieved as text-type data "YYYY/MM/DD" in the text field "S2"

    • Calculation-formula: DTOC(DATE())

    • Printing result: "2005/01/10"

IDATE

Feature

Retrieves the system date.

Format

IDATE()

Settings

This will retrieve the system date at the time of printing (when the VrInit function is executed) as date-type data (YYYYMMDD).

Usage examples

Reference

Specify this function if you want to output the same printing date on all of the pages in the same spool data.

  • Example 1

    When converting the system date (at the time of executing VrInit) into date-type data "YYYYMMDD", and outputting to the text field "S2"

    When converting the system date (at the time of executing VrInit) into date-type data "YYYYMMDD", and outputting to the numeric field "I2"

    • Edit-formula: IDATE()

    • Printing result

      Text field "S2": 20050110

      Numeric field "I2": 20050110

  • Example 2: When converting the system date (at the time of executing VrInit) into date-type data "YYYYMMDD", using the value of the text field "S2" and the numeric field "I2"

    • Calculation-formula

      Text field "S2": IDATE()

      Numeric field "I2": VAL(IDATE())

    • Printing result

      Text field "S2": 20050110

      Numeric field "I2": 20050110

  • Example 3: When the system date (at the time of executing VrInit) is retrieved as text-type data "YYYY/MM/DD" in the text field "S2"

    • Calculation-formula: DTOC(IDATE())

    • Printing result: "2005/01/10"

CTOD

Feature

Converts text-type data (YYYY/MM/DD) into date-type data (YYYYMMDD).

Format

CTOD(string_or_character_field_name)

Settings

  1. In "string_or_character_field_name", specify the text-type data to convert, or the name of the field that contains the data.

  2. This will convert "string_or_character_field_name" into date-type data.

Usage examples

Prerequisite

Text-type data "2005/01/10" is entered in the text field "S1"

  • Example 1: When converting text-type data from the field "S1" into date-type data "YYYYMMDD", and outputting to the text field "S2"

    • Edit-formula: CTOD(S1)

    • Printing result: 20050110

  • Example 2: When converting text-type data from the field "S1" into date-type data "YYYYMMDD", and using as the value of the text field "S2"

    • Calculation-formula: CTOD(S1)

    • Printing result: 20050110

CDOW

Feature

Retrieves the name of the day of the week as text-type data from date-type data (YYYYMMDD).

Format

CDOW(date_data)

Settings

  1. In "date_data", specify the date-type data (or text-type data) from which to get the day of the week, or the name of the field that contains the data.

  2. This will retrieve the day of the week from "date_data".

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When calculating the day of the week from date-type data in the field "S1", and outputting to the text field "S2"

    • Edit-formula: CDOW(S1)

    • Printing result: "Mon"

  • Example 2: When calculating the day of the week from date-type data in the field "S1", and using as the value of the text field "S2"

    • Calculation-formula: CDOW(S1)

    • Printing result: "Mon"

  • Example 3: When calculating the day of the week from the system date, and outputting to the text field "S2"

    • Edit-formula: CDOW(DATE())

    • Printing result: "Mon"

ADATE

Feature

Adds (or subtracts) the specified number of days to (or from) a date, and retrieves the result as date-type data (YYYYMMDD).

Format

ADATE(date_data,numeric_data)

Settings

  1. In "date_data", specify the date-type data (or text-type data) to be calculated, or the name of the field that contains the data.

  2. In "numeric_data", specify the number of days to be added or subtracted.

  3. This will add (or subtract) "numeric_data" days to (or from) "date_data" and retrieve the calculated date-type data (YYYYMMDD).

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When calculating the date 30 days after the date-type data in the field "S1", and outputting the calculated date-type data "YYYYMMDD" to the text field "S2"

    • Edit-formula: ADATE(S1,30)

    • Printing result: 20050209

  • Example 2: When calculating the date 30 days after the date-type data in the field "S1", and using the calculated date-type data "YYYYMMDD" as the value of the text field "S2"

    • Calculation-formula: ADATE(S1,30)

    • Printing result: 20050209

  • Example 3: When calculating the date 30 days before the system date, and outputting the calculated text-type data "YYYY/MM/DD" to the text field "S2"

    • Edit-formula: DTOC(ADATE(DATE(),-30))

    • Printing result: "2004/12/11"

YEAR

Feature

Retrieves only the Western calendar year as numeric-type data from date-type data (YYYYMMDD).

Format

YEAR(date_data)

Settings

  1. In "date_data", specify the date-type data (or text-type data) from which to get the year, or the name of the field that contains the data.

  2. This will retrieve only the YYYY part from "date_data" as numeric-type data.

Caution

Because the value is retrieved as numeric-type data, if the function is used in the edit-formula, the value must be converted into text-type data by using the FORMAT or STR function before using the result.

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When calculating the Western calendar year "YYYY" from date-type data in the field "S1", and outputting to the numeric field "I2"

    • Edit-formula: FORMAT(YEAR(S1),"ZZZ9")

    • Printing result: "2005"

  • Example 2: When calculating the Western calendar year "YYYY" from date-type data in the field "S1", and using it as the value of the numeric field "I2"

    • Calculation-formula: YEAR(S1)

    • Printing result: 2005

  • Example 3: When calculating the Western calendar year "YYYY" from the system date, and using it as the value of the numeric field "I2"

    • Edit-formula: STR(YEAR(DATE()))

    • Printing result: "2005"

WYEAR

Feature

Retrieves only the Japanese calendar year as numeric-type data from date-type data (YYYYMMDD).

Format

WYEAR(date_data)

Settings

  1. In "date_data", specify the date-type data (or text-type data) from which to get the Japanese calendar year, or the name of the field that contains the data.

  2. This will retrieve only the "YY" Japanese calendar year part from "date_data" as numeric-type data.

Caution

Because the value is retrieved as numeric-type data, if the function is used in the edit-formula, the value must be converted into text-type data by using the FORMAT or STR function before using the result.

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When calculating the Japanese calendar year "YY" from date-type data in the field "S1", and outputting to the numeric field "I2"

    • Edit-formula: FORMAT(WYEAR(S1),"ZZ9")

    • Printing result: "Tri_W_Up.gif17" (Tri_W_Up.gif=half-width space)

  • Example 2: When calculating the Japanese calendar year "YY" from date-type data in the field "S1", and using it as the value of the numeric field "I2"

    • Calculation-formula: WYEAR(S1)

    • Printing result: 17

  • Example 3: When calculating the Japanese calendar year "YY" from the system date, and outputting to the numeric field "I2"

    • Edit-formula: STR(WYEAR(DATE()))

    • Printing result: "17"

MONTH

Feature

Retrieves only the month as numeric-type data from date-type data (YYYYMMDD).

Format

MONTH(date_data)

Settings

  1. In "date_data", specify the date-type data (or text-type data) from which to get the month, or the name of the field that contains the data.

  2. This will retrieve only the MM part from "date_data" as numeric-type data.

Caution

Because the value is retrieved as numeric-type data, if the function is used in the edit-formula, the value must be converted into text-type data by using the FORMAT or STR function before using the result.

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When calculating the month "MM" from date-type data in the field "S1", and outputting to the numeric field "I2"

    • Edit-formula: FORMAT(MONTH(S1),"Z9")

    • Printing result: "Tri_W_Up.gif1" (Tri_W_Up.gif=half-width space)

  • Example 2: When calculating the month "MM" from date-type data in the field "S1", and using it as the value of the numeric field "I2"

    • Calculation-formula: MONTH(S1)

    • Printing result: 1

  • Example 3: When calculating the month "MM" from the system date, and outputting to the numeric field "I2"

    • Edit-formula: STR(MONTH(DATE()))

    • Printing result: "1"

MONTH2

Feature

Retrieves only the month as text-type data from date-type data (YYYYMMDD).

Format

MONTH2(date_data)

Settings

  1. In "date_data", specify the date-type data (or text-type data) from which to get the month, or the name of the field that contains the data.

  2. This will retrieve only the MM part from "date_data" as text-type data in the format of 1=Jan, 2=Feb, 3=Mar, and so on.

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When calculating the month "MM" from date-type data in the field "S1", and outputting Jan, Feb, Mar, ... Dec to the text field "S2"

    • Edit-formula: MONTH2(S1)

    • Printing result: "Jan"

  • Example 2: When calculating the month "MM" from date-type data in the field "S1", and using Jan, Feb, Mar, ... Dec as the value of the text field "S2"

    • Calculation-formula: MONTH2(S1)

    • Printing result: "Jan"

  • Example 3: When calculating the month "MM" from the system date, and outputting Jan, Feb, Mar, ... Dec to the text field "S2"

    • Edit-formula: MONTH2(DATE())

    • Printing result: "Jan"

DAY

Feature

Retrieves only the day as numeric-type data from date-type data (YYYYMMDD).

Format

DAY(date_data)

Settings

  1. In "date_data", specify the date-type data (or text-type data) from which to get the day, or the name of the field that contains the data.

  2. This will retrieve only the DD part from "date_data" as numeric-type data.

Caution

Because the value is retrieved as numeric-type data, if the function is used in the edit-formula, the value must be converted into text-type data by using the FORMAT or STR function before using the result.

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When calculating the day "DD" from date-type data in the field "S1", and outputting to the numeric field "I2"

    • Edit-formula: FORMAT(DAY(S1),"Z9")

    • Printing result: "10"

  • Example 2: When calculating the day "DD" from date-type data in the field "S1", and using it as the value of the numeric field "I2"

    • Calculation-formula: DAY(S1)

    • Printing result: 10

  • Example 3: When calculating the day "DD" from the system date, and outputting to the numeric field "I2"

    • Edit-formula: STR(DAY(DATE()))

    • Printing result: "10"

DOW

Feature

Calculates the day of the week from date-type data (YYYYMMDD) and retrieves the corresponding numeric-type data.

Format

DOW(date_data)

Settings

  1. In "date_data", specify the date-type data (or text-type data) from which to get the day of the week, or the name of the field that contains the data.

  2. This will retrieve numeric-type data corresponding to the day of the week from "date_data".

Reference

The numeric values corresponding to the day of the week are as follows:

Sunday

Monday

Tuesday

Wednesday

Thursday

Friday

Saturday

0

1

2

3

4

5

6

Caution

Because the value is retrieved as numeric-type data, if the function is used in the edit-formula, the value must be converted into text-type data by using the FORMAT or STR function before using the result.

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When calculating numeric data corresponding to the day of the week from date-type data in the field "S1", and outputting to the numeric field "I2"

    • Edit-formula: FORMAT(DOW(S1),"Z9")

    • Printing result: "Tri_W_Up.gif1" (Tri_W_Up.gif=half-width space)

  • Example 2: When calculating numeric data corresponding to the day of the week from date-type data in the field "S1", and using it as the value of the numeric field "I2"

    • Calculation-formula: DOW(S1)

    • Printing result: 1

  • Example 3: When calculating numeric data corresponding to the day of the week, and outputting to the numeric field "I2"

    • Edit-formula: STR(DOW(DATE()))

    • Printing result: "1"

CDATE

Feature

Calculates the number of days within the period and retrieves the result as numeric-type data.

Format

CDATE(date_data1,date_data2)

Settings

  1. In "date_data1", specify the date-type data (or text-type data) for the start date to calculate the period, or the name of the field that contains the data.

  2. In "date_data2", specify the date-type data (or text-type data) of the end date for calculating the period, or the name of the field that contains the data.

  3. This will subtract "date_data2" from "date_data1" and retrieve the calculated value as numeric-type data.

Caution

Because the value is retrieved as numeric-type data, if the function is used in the edit-formula, the value must be converted into text-type data by using the FORMAT or STR function before using the result.

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When calculating the number of days between the date-type data in the field "S1" and the system date ("2005/12/31"), and outputting the calculated numeric-type data to the numeric field "I2"

    • Edit-formula: FORMAT(CDATE(S1,DATE()),"ZZZ9")

    • Printing result: "Tri_W_Up.gif-355" (Tri_W_Up.gif=half-width space)

  • Example 2: When calculating the number of days between the date-type data in the field "S1" and the system date ("2005/12/31"), and using the calculated numeric-type data as the value of the numeric field "I2"

    • Calculation-formula: CDATE(S1,DATE())

    • Printing result: -355

Reference

If 2005/01/10 is specified as Date1 and 2005/12/31 is specified as Date2, the number of days passed is retrieved as a negative value since Date2 is subtracted from Date1.

If you want to retrieve 355 for the number of days passed as a positive value, specify CDATE("2005/12/31","2005/01/10").

SEI2WA / SEI2WA1 / SEI2WA1Z

Feature

Converts the Western calendar date-type data to the Japanese calendar date, and retrieves the result as text-type data.

Reference

  • The five Japanese calendar eras available for conversion are as follows: 明治 (Meiji), 大正 (Taisho), 昭和 (Showa), 平成 (Heisei), and 令和 (Reiwa).

  • The following four Western calendar date formats can be used for conversion:

    2005/01/10

    Text-type data

    20050110

    Date-type data

    05/01/10

    Text-type data in which "/" is entered between the Western calendar Year (two digits), Month (two digits), and Date (two digits)

    050110

    Date-type data in which the Western calendar Year (two digits), Month (two digits), and Date (two digits) are entered as consecutive digits

SEI2WA

Format

SEI2WA(date_data)

Settings

  1. In "date_data", specify the Western calendar date-type data (or text-type data), or the name of the field that contains the data.

  2. This will convert "date_data" into the "<Era_name>YYMMDD" format of the Japanese calendar.

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When converting date-type data from the field "S1" into the "<Era_name>YYMMDD" format of the Japanese calendar, and outputting to the text field "S2"

    • Edit-formula: SEI2WA(S1)

    • Printing result: "平成170110"

  • Example 2: When converting date-type data from the field "S1" into the "<Era_name>YYMMDD" format of the Japanese calendar, and using as the value of the text field "S2"

    • Calculation-formula: SEI2WA(S1)

    • Printing result: "平成170110"

SEI2WA1

Format

SEI2WA1(date_data)

Settings

  1. In "date_data", specify the Western calendar date-type data (or text-type data), or the name of the field that contains the data.

  2. This will convert "date_data" into the "<Era_name>YY年MM月DD日" format of the Japanese calendar.

  3. The data is displayed without performing zero suppression for 0 in the first digit of any of the parts YY, MM, or DD.

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When converting date-type data from the field "S1" into the "<Era_name>YY年MM月DD日" format of the Japanese calendar, and outputting to the text field "S2"

    • Edit-formula: SEI2WA1(S1)

    • Printing result: "平成17年01月10日"

  • Example 2: When converting date-type data from the field "S1" into the "<Era_name>YY年MM月DD日" format of the Japanese calendar, and using as the value of the text field "S2"

    • Calculation-formula: SEI2WA1(S1)

    • Printing result: "平成17年01月10日"

SEI2WA1Z

Format

SEI2WA1Z(date_data)

Settings

  1. In "date_data", specify the Western calendar date-type data (or text-type data), or the name of the field that contains the data.

  2. This will convert "date_data" into the "<Era_name>YY年MM月DD日" format of the Japanese calendar.

  3. The data is displayed with zero suppression performed for 0 in the first digit of any of the parts YY, MM, or DD.

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When converting date-type data from the field "S1" into the "<Era_name>YY年MM月DD日" format of the Japanese calendar, with zero suppression performed, and outputting to the text field "S2"

    • Edit-formula: SEI2WA1Z(S1)

    • Printing result: "平成17年Tri_W_Up.gif1月10日" (Tri_W_Up.gif=half-width space)

  • Example 2: When converting date-type data from the field "S1" into the "<Era_name>YY年MM月DD日" format of the Japanese calendar, with zero suppression performed, and using as the value of the text field "S2"

    • Calculation-formula: SEI2WA1Z(S1)

    • Printing result: "平成17年Tri_W_Up.gif1月10日" (Tri_W_Up.gif=half-width space)

WA2SEI

Feature

Converts the Japanese calendar text-type data to the Western calendar date, and retrieves the result as date-type data.

Format

WA2SEI(Japanese_era_string)

Settings

  1. In "Japanese_era_string", specify the Japanese calendar text-type data, or the name of the field that contains the data.

  2. This will retrieve the Western calendar date converted from "Japanese_era_string".

Reference

  • The five Japanese calendar eras are as follows: M=明治 (Meiji), T=大正 (Taisho), S=昭和 (Showa), H=平成 (Heisei), and R=令和 (Reiwa).

  • Convertible Japanese calendar date data must be specified as eight digits, such as "HTri_W_Up.gif170110" (Tri_W_Up.gif=half-width space).

Usage examples

Prerequisite

Date-type data "HTri_W_Up.gif170110" is entered in the text field "S1"

  • Example 1: When converting the Japanese calendar text-type data from the field "S1" into the Western calendar, and outputting date-type data "YYYYMMDD" to the text field "S2"

    • Edit-formula: WA2SEI(S1)

    • Printing result: "20050110"

  • Example 2: When converting the Japanese calendar text-type data from the field "S1" into the Western calendar, and using date-type data "YYYYMMDD" as the value of the text field "S2"

    • Calculation-formula: WA2SEI(S1)

    • Printing result: "20050110"

  • Example 3: When converting the Japanese calendar text-type data from the field "S1" into the Western calendar, and using text-type data "YYYY/MM/DD" as the value of the text field "S2"

    • Calculation-formula: DTOC(WA2SEI(S1))

    • Printing result: "2005/01/10"

NENGO

Feature

Retrieves the Era name of the Japanese calendar (era) from Western calendar date-type data.

Format

NENGO(date_data)

Settings

  1. In "date_data", specify the Western calendar date-type data (or text-type data), or the name of the field that contains the data.

  2. The Era name of the Japanese calendar is retrieved from "date_data".

Reference

  • The five Japanese calendar eras available for conversion are as follows: 明治 (Meiji), 大正 (Taisho), 昭和 (Showa), 平成 (Heisei), and 令和 (Reiwa).

  • The following four Western calendar date formats can be used for conversion:

    2005/01/10

    Text-type data

    20050110

    Date-type data

    05/01/10

    Text-type data in which "/" is entered between the Western calendar Year (two digits), Month (two digits), and Date (two digits)

    050110

    Date-type data in which the Western calendar Year (two digits), Month (two digits), and Date (two digits) are entered as consecutive digits

Usage examples

Prerequisite

Date-type data "20050110" is entered in the text field "S1"

  • Example 1: When converting date-type data from the field "S1" into the era name of the Japanese calendar, and outputting to the text field "S2"

    • Edit-formula: NENGO(S1)

    • Printing result: "平成"

  • Example 2: When converting date-type data from the field "S1" into the era name of the Japanese calendar, and using as the value of the text field "S2"

    • Calculation-formula: NENGO(S1)

    • Printing result: "平成"