cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CBTA date format issue: Why is the &today& token and other vbscript returning 06/13/2024 as 6/13/20?

JeannineGardner1
Explorer
0 Kudos
476

I have a question I hope someone can help me with:

CBTA date format issue: Why is the token/vbscript returning the date format as DMMYYYY without the zero before the single digit month; for example, instead of returning 06/13/2024 it's returning 6/13/2024?

Here are the details of this issue:

The CBTA script extracts data from SAP, creates a file and sends the resulting file to an AL11 directory.
The script navigates to the directory path, sorts the files in descending order such that the current date displays on the top row.
Then the date is captured with checkproperty (a parameter) and compared to today's date, which is picked up as it is displayed on screen (format MMDDYYYY) as expected.
However, when the parameter is compared to today's date using any of the three methods listed in item 5 below; the date does not include the zero before the month, where month is June for instance. For example, Jun is returned as 6/13/2024 (format MDDYYYY) instead of 06/13/2024. Therefore, the script fails with the following error:
Target: GridCell_0_MOD_DATE
- The 'GetCellValue(0, "MOD_DATE")' property is set to: 06/13/2024
- It has been compared to: 6/13/2024
- Using the operator: =

5. Received the same error using any/all of the 3 items below:

%today%
%=month(now())&"/"&day(now())+1&"/"&year(now())%
%=Month($today$)%/%=Day($today$)%/%=Year($today$)%

Thank you,

Jeannine

View Entire Topic
vijayjeethuri
Participant
0 Kudos

Hello,

Below token code should work for date validation:

%=Month(now())%/%=Day(now())%/%=Year(now())%