-1

Question is there a way to convert a mm-dd-yyyy date format into mmm-dd-yyyy .I want it to look like this (Ex. Nov 19, 2019)?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Luna
  • 21
  • 1
  • 4
  • did you just try Cdate(dateinstring).tostring(“MMM-dd-yyyy”) – redhatvicky Nov 19 '19 at 01:23
  • No sir? My current way is get the date and stored them in a variable and then I format the variable ? Like this $MDate$\$DDate$\$YDate$ – Luna Nov 19 '19 at 01:28
  • Ohh sorry xD Are your talking about the source string ?? In that case yes, I perform a string operation to get them separately and then a variable operation to form them like that ? – Luna Nov 19 '19 at 01:32
  • Apparently one can asssign as System.Globalization.CultureInfo.InvariantCulture which makes it available for date fuctions and then you can pass this variable to a new format "mmm-dd-yyyy" , This might also help you , As you dint want to reassign the default variable setting , i just suggested you to use Cdate(dateinstring).tostring(“MMM-dd-yyyy”) . Let me know if i am missing something. – redhatvicky Nov 19 '19 at 01:38
  • Im not really familiar with System.Globalization.CultureInfo.InvariantCulture. Tho I already made a way to get the month but I just want the Idea to convert that so I can also get the day today? like monday or tuesday ?? Once again sorry Im just a beginner not really familiar with your way also if you have time can you please send a actual screenshot of this action Cdate(dateinstring).tostring(“MMM-dd-yyyy”)? Thank you – Luna Nov 19 '19 at 01:45
  • In case you want to know my current way, I just simple use if and else if function 11 time :), sorry I cant send a screenshot? there's not button for picture upload ? – Luna Nov 19 '19 at 01:48
  • There is image upload as part of the body where you enter the question , So you can edit the question and add the image or else upload it in a third part site and provide the link here , Screen shot your existing logic which will help us to solve the problem.with minimum followups. – redhatvicky Nov 21 '19 at 13:43

4 Answers4

0

You cannot change the date format in automation anywhere without changing the default Date System Variables setting.

You have to either use script to convert the date to required format.

(OR)

Metabot to convert the date to required format. There are various metabots available in Bot Store for Date conversion and validation.

Refer: https://botstore.automationanywhere.com/bot/change-date-format/

https://botstore.automationanywhere.com/bot/change-date-and-time-format/

https://botstore.automationanywhere.com/bot/perform-date-time-operations/

chimbu
  • 104
  • 1
  • 11
0

If you don't want to change de default format, your only 2 options would be to manipulate the string, performing the specific variable operations needed. I have done this manually in the past but I believe many MetaBots exist that do this kind of tasks.

Why don't you want to change the default format? It would be easier to have that format set up there, and when you need to work with other formats its easier to use the $Day$, $Month$, $Hour$, etc. variables to aid you in constructing a string with the desired format.

0

Download the Datetime Metabot from the bot store. Use the FormatString function to pass the date you want to modify, the date format you want to modify it too and the variable you want to save it to.

0

I had to convert a MM to MMM the other day, the way I did it was I created an Excel file that had the three letter months in order (1-12, starting with Jan ending with Dec) and created a task to look up the month in the Excel file based of the month variable in Automation Anywhere.

I have never tested the metabot but there are meta bots for date conversions as well.

Unbarred
  • 1
  • 1
  • 3