Get Date Time Part

Gets part of a Date Time value and stores it in a variable.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

getDatePart --date(DateTime) --type(DatePart) (Numeric)=value

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Date date Required Date Time Complete Date Time value from where a part should be obtained.
Part type Required DatePart Option that defines the part of the Date Time value that should be obtained.

Output parameters

Designer mode label Script mode name Accepted variable types Description
Date Part value Number Returns the part of the date that was obtained.

Example

Gets the day part of a Date Time value ("2012-02-08 12:15:18").

defVar --name fullDate --type DateTime --value "2012-02-08 12:15:18" 
defVar --name datePart --type Numeric 
getDatePart --date "${fullDate}" --type "Days" datePart=value
logMessage --message "${datePart}" --type "Info"
// Returns the "8th" day.​