Date Formulae

Introduction

Sapper supports a variety of Date formulas. Those are mentioned in this section.

Formulas

Current Date

Description 

It represents the current date with output and time zone.

Syntax 

Expression: String outputFormat, String timeZone

Return Type: String

Example 

Expression:  String outputFormat,String timeZone

Result: CURRENT_DATE("dd/MM/yyyy HH:mm:ss","PST")

Modify Date

Description 

It represent the returns any date incremented or decremented by specified unit of time(days/months/years/hours/minutes/seconds

Syntax 

Expression: String date,int amount,String unit

Return Type: LocalDateTime

Example 

Expression:  String date,int amount,String unit

Result: MODIFY_DATE("03/03/2022",2,"months")

Previous Date

Description 

It represent the returns an earlier date by a specified unit of time(days/months/years/hours/minutes/seconds)

Syntax 

Expression: String date,int amount,String unit

Return Type: LocalDateTime

Example 

Expression:  String date,int amount,String unit

Result: PREVIOUS_DATE("03/03/2022",2,"days")

Day of week

Description 

It represent the returns day of the week. Sunday returns 0, Monday returns 1

Syntax 

Expression: String date

Return Type: Integer

Example 

Expression:  String date

Result: DAY_OF_WEEK("05/03/2022")

Day number of year

Description 

It represent the returns day number of the year

Syntax 

Expression: String date

Return Type: Integer

Example 

Expression:  String date

Result: DAY_NUMBER_OF_YEAR(("03/03/2022")

Start of Hour

Description 

It represent the returns date for top-of-the-hour for a given date

Syntax 

Expression: String date

Return Type: LocalDateTime

Example 

Expression:  String date

Result: START_OF_HOUR("03-03-2022 10:30:30")

Start of Day

Description 

It represent the returns date and time for midnight on date of a given date or date and time.

Syntax 

Expression: String date

Return Type: LocalDateTime

Example 

Expression:  String date

Result: START_OF_DAY ("2022-03-03")

Start of Month

Description 

It represent the returns first day of the month for a given date

Syntax 

Expression: String date

Return Type: LocalDateTime

Example 

Expression:  String date

Result: START_OF_MONTH("2022-03-03 11:30")

Start of Year

Description 

It represent the returns first day of the year for a given date

Syntax 

Expression: String date

Return Type: LocalDateTime

Example 

Expression:  String date

Result: START_OF_YEAR("2022-03-03 11:30")

Start of Week

Description 

It represent the returns date of the Monday for a given date(Week starts from monday)

Syntax 

Expression: String date

Return Type: LocalDateTime

Example 

Expression:  String date

Result: START_OF_WEEK("2022-03-10")

Last day of Month

Description 

It represent the returns last day of the month for a given date

Syntax 

Expression: String date

Return Type: LocalDateTime

Example 

Expression:  String date

Result: LAST_DAY_OF_MONTH("03-03-2022")

To covert Specific Format

Description 

It represent the convert a date into the given specific date format

Syntax 

Expression: String date,String outputFormat,String timeZone

Return Type: String

Example 

Expression:  String date,String outputFormat,String timeZone

Result: TO_CONVERT_SPECIFIC_FORMAT("2022/03/03 11:21","yyyy-MM-dd HH:mm:ss","PST")