cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert date format (dd/mm/yyyy) to (mm/dd/yyyy)

PrasanthChiruku
Level 4
Hi Team,
Can anyone help me to achieve this date conversion (dd/mm/yyyy) to (MM/dd/yyyy)

------------------------------
Prasanth Chirukuri
RPA Developer
iOPEX Technologies
Asia/Kolkata
------------------------------
6 REPLIES 6

VivekGoel
Level 10
Assuming:
1- Input format is of String
2- The input format is fixed to be "dd/mm/yyyy"

Solution: 

FormatDate(MakeDate(Mid("24/10/2019", 1, 2), Mid("24/10/2019", 4, 2), Mid("24/10/2019", 7,4)), "MM/dd/yyyy")

30273.png





------------------------------
Vivek Goel
RPA Architect
Asia/Singapore
+6594554364
https://www.rpatools.com/
"If you like this post, please press the "Recommend" Button.
------------------------------

Hi Vivek,
Thank you for your quick response.
We can solve this using Date and time manipulation VBO Format date action Input - Pass as date formate like-2/23/2019 2nd input give date format mm/dd/yyyy.



------------------------------
Prasanth Chirukuri
RPA Developer
iOPEX Technologies
Asia/Kolkata
------------------------------

Hi prashant,

Remember, "Format Date" only works if your input is  a "DateTime" . If your input is a string, then essentially you will have to convert the string to date time using string manipulation and then use format date which is similar to the one liner I provided in my earlier reply.

But if your input is already in datetime, then your solution will work perfectly. Kudos

------------------------------
Vivek Goel
RPA Architect
Asia/Singapore
https://www.rpatools.com/
"If you like this post, please press the "Recommend" Button.
------------------------------

Walter.Koller
Level 11
Please be aware of different behavior of FormatDate depending on your regional settings in Windows.
Below is the result of non-English date format settings in Windows and format vs resulting string.

30276.png


------------------------------
Walter Koller
Solution Manager
Erste Group IT International GmbH
Europe/Vienna
------------------------------

ydar360
Level 3
May I suggest a less complicated approach?

Use the Import the Pre-Configured Utility- Date and Time Manipulation Business Object and simply enter the preferred format of your date as shown in the picture. It works like a charm. The example below will convert 2/6/2023 to 06/02/2023.
30277.png


------------------------------
Awoyinka Daramola
------------------------------

...interesting, thanks for pointing that out.

------------------------------
Happy coding!
---------------
Paul
Sweden
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)