How to use SET_DATE command to create a specific date in a particular format?

You can use the SET_DATE command to create a specific date in a specific format. This command takes the following parameters:

Variable name: This is the variable name where you would like to store the created date into

Source: This is where the date value is coming from. It could either be @System.date for the current date or a specific date. Example: @System.date which takes your computer's system date (today's date) or @another_variable defined through SET_VAR or GET_WEB_VALUE commands.

Source Format: This is the format for the source date. Example: yyyy-dd-MM. Other date patterns can be obtained from the website: https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html

Target Format: This is the format for the date resulting from this command. Example: yyyy-dd-MM. Other date patterns can be obtained from the website: https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html

Offset: This adds or removes hours, days, months, or years from the date obtained in source above. Example: +1d (adds one day), -2M (removes 2 months), +1y (adds one year)

Example 1 using system.date:

SET_DATE HALT yesterday @System.date "yyyy-dd-MM" "yyyy-dd-MM" "-1d" (References to wizard for this command: Variable name = yesterday, Source Format = @System.date, Target Format = yyyy-dd-MM, Offset = -1d to go back one day)

Example 2 using a user defined date:

SET_VAR HALT Static my_date "2014/01/01"

SET_DATE HALT one_year_before_my_date @my_date "yyyy/dd/MM" "yyyy-dd-MM" "-1y"

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Please sign in to leave a comment.