- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 08:33 PM
I've a requirement where I'll give input some Date and I want to get Day and Month of that date. Need script help for that
Example:
input: 2022-08-17
Output:
Day: 17
Month: 08
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2022 05:17 AM
Hello
You can follow the below steps.
Go to Flow designer click on create new Action.
1. Create action input step:
2. click on + icon and slect Script to create a Script action. Create Input Variables for script step to provide the input to the script. Click on Data pill picker to add the value to this variable from Inputs--> Date time variable. (ie. variable from step 1)
In script specify the below script:
(function execute(inputs, outputs) {
var dateGDT = new GlideDate();
dateGDT.setValue(inputs.date_value + "");
outputs.month_value = dateGDT.getMonthNoTZ();
outputs.date_value = dateGDT.getDayOfMonthNoTZ();
})(inputs, outputs);
Create Output vairable for script step as show below:
3. Create Outputs as shown below. You need to first create Output variables. Click on Exist Edit mode button. Then assign the value to those variable by clicking on Data pill picker icon and using the variable created as output variables in step 2.
Click on Save. Then to test the action click on Test button. Provide the date value and then check the values in flow execution:
If my answer helped you in any way then please do mark it as helpful. If it answered your question then please mark it correct and helpful. This will help others with similar issue to find the correct answer.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 10:57 PM
Hello
Just wanted to check with you, if the above response answered your question. If yes, then please do close this thread/question by marking the appropriate response as correct.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2022 07:13 AM