cancel
Showing results for 
Search instead for 
Did you mean: 

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

JeannineGardner1
Explorer
0 Kudos
173

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
rmangin
Associate
Associate

Hello Jeannine,

CBTA interpret %today% and more generally date tokens by using native Windows VBScript functions for which result is directly depending on the Windows date display format (region dependent).

Actually, the leading 0 for the month part of today's date will be present if you select a Windows Date Display Format that is presenting it. You have to select a date format that will both match your windows settings and your test user settings in the corresponding SAP system (transaction SU3 from the tester session).

Best Regards,
Rémi,
CIS - SAP Support.

JeannineGardner1
Explorer
0 Kudos
Thank you so much! I changed my Windows date display and it worked just fine.