Cannot convert date expectedly with FormatDate function
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
23-10-22 02:32 PM
Hi,
I would like to convert the date as per below, but it doesn't work. I'm using 6.10.3 in Japan.
My Expectation
Function : FormatDate("2022/10/23", "ddMMMyy")
Result : "23Oct22"
Current Actual
Function : FormatDate("2022/10/23", "ddMMMyy")
Rsult : "231022"
I do not know why this function behaves like this, which deos not follow the specification from BluePrism official definition. I hope your help, anyone.
Thanks for reading.
------------------------------
Shohei Otsu
------------------------------
I would like to convert the date as per below, but it doesn't work. I'm using 6.10.3 in Japan.
My Expectation
Function : FormatDate("2022/10/23", "ddMMMyy")
Result : "23Oct22"
Current Actual
Function : FormatDate("2022/10/23", "ddMMMyy")
Rsult : "231022"
I do not know why this function behaves like this, which deos not follow the specification from BluePrism official definition. I hope your help, anyone.
Thanks for reading.
------------------------------
Shohei Otsu
------------------------------
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
24-10-22 06:47 AM
Hi S,
We are on 6.10.5 but I gave it a try anyway. I tried the following:
------------------------------
Happy coding!
---------------
Paul
Sweden
------------------------------
We are on 6.10.5 but I gave it a try anyway. I tried the following:
- FormatDate(Today(), "ddMMMyy") which gives "24Oct22"
- FormatDate(Today(), "ddMMyy") that gives "241022"
------------------------------
Happy coding!
---------------
Paul
Sweden
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)
Paul, Sweden
(By all means, do not mark this as the best answer!)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
24-10-22 02:37 PM
@ShoheiOtsu
The DateTimeFormatInfo.AbbreviatedMonthNames property for the culture setting ja-JP is defined as numbers. You won't get month abbreviations.
------------------------------
Micheal Charron
Senior Manager
RBC
America/Toronto
------------------------------
The DateTimeFormatInfo.AbbreviatedMonthNames property for the culture setting ja-JP is defined as numbers. You won't get month abbreviations.
------------------------------
Micheal Charron
Senior Manager
RBC
America/Toronto
------------------------------
Micheal Charron
RBC
Toronto, Ontario
Canada
RBC
Toronto, Ontario
Canada
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
24-10-22 11:56 PM
@Micheal Charron
Oh, ok. I will search other method which meets my requirement. Thank you for the information
@Paul JHM van Doorn
Thank you for the response. My question is resoved as per Micheal's answer.
------------------------------
Shohei Otsu
------------------------------
Oh, ok. I will search other method which meets my requirement. Thank you for the information
@Paul JHM van Doorn
Thank you for the response. My question is resoved as per Micheal's answer.
------------------------------
Shohei Otsu
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
25-10-22 12:51 PM
@ShoheiOtsu
If you want to keep it as a calculation, might I suggest:
FormatDate([Source Date],"dd") & Mid("JanFebMarAprMayJunJulAugSepOctNovDec", ((ToNumber(FormatDate([Source Date],"MM"))-1) * 3)+1, 3) & FormatDate([Source Date],"yy")
It's ugly but it works.
------------------------------
Micheal Charron
Senior Manager
RBC
America/Toronto
------------------------------
Micheal Charron
RBC
Toronto, Ontario
Canada
RBC
Toronto, Ontario
Canada
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-10-22 11:58 PM
@MichealCharron
I tried it and confirmed it works!! Thank you for the instruction.
------------------------------
Shohei Otsu
------------------------------
I tried it and confirmed it works!! Thank you for the instruction.
------------------------------
Shohei Otsu
------------------------------
