mc84usa
February 20, 2023, 11:20pm
1
I was wondering how I could obtain today’s date (MM-DD-YYYY) on a scrape, more specifically, the numerical value for the day; for example, if 06-21-2023, I would like to obtain the day, which would be 21.
You can use split command to cut a part of the date
Split code working like a charm tested !
{
"Name": "Split_Function",
"CreationDate": "2019-10-26",
"Commands": [
{
"Command": "store",
"Target": "11111-22222",
"Value": "Col"
},
{
"Command": "executeScript_Sandbox",
"Target": "return ${Col}.split(\"-\")[0].trim();",
"Value": "First_Part"
},
{
"Command": "echo",
"Target": "${First_Part}",
"Value": ""
},
{
"Command": "executeScript_Sandbox",
"Targe…
mc84usa
February 22, 2023, 6:18pm
3
@newuserkantu , thanks for the reply so basically i would just need to split the date a third time to remove mm-dd-yyyy?
However, how would you suggest obtaining today’s date as I did not find today’s date in the source code for the site? Currently, 1/2 of the team is on Macs and 1/2 on Windows…
uiuser
February 22, 2023, 7:13pm
4
{
"Command": "executeScript",
"Target": "\nvar d= new Date(); return d.getDate().toString().padStart(2, \"0\");",
"Value": "Date",
"Description": ""
}
mc84usa
February 22, 2023, 7:47pm
5
Your the best I just located the following as well:
Loving this program; having an issue though conceptually and have looked for hours on how to do this. I am automating a file download where you have to enter a start and ending date. Start date is always fixed, has to be in 01/01/18 format, however the ending date needs to be today’s date, in that format. Is there not a built in variable that just uses today’s date that I can then use in a ‘type’ command as the value? Not sure if I have to use some code in ‘target’ using ‘storevalue’ to take…
var d= new Date(); var d=(d.getDate()); return d;
mc84usa
February 22, 2023, 7:48pm
6
uiuser:
"Command": "executeScript",
"Target": "\nvar d= new Date(); return d.getDate().toString().padStart(2, \"0\");",
"Value": "Date",
"Description": ""
@uiuser
What is the difference between using your version and the following:
var d= new Date(); var d=(d.getDate()); return d;```
uiuser
February 22, 2023, 8:05pm
7
use this
gives same result
Solution provided by @uiuser it is much easier compared to using the split command