You need to sign in to do that
Don't have an account?

String representation for Month of Date
Hi
I'm trying yo write code that generates a string which includes the Month e.g. January.
From the Date object I have the integer representing January (1) but I want the String.
I also wish this string will adopt to the relevant Language.
I know I can use Custom Labels and CASE statement but before I do that I want some help, maybe there is a better more native way to achive the same.
Thanks
Assuming the date you are dealing with is DATE type object (& not DateTime), you could use below approach for fetching month value as January -
If you print the value of String variable ('target' in above example), you will get JANUARY.
Hope this answers first part of your question.
For converting this into Local language, I believe we have to leverage "Multi lingual" capability of the Salesforce. But haven't tried that myself yet. Hence can't provide a straight answer to that.
- Satgur
All Answers
Assuming the date you are dealing with is DATE type object (& not DateTime), you could use below approach for fetching month value as January -
If you print the value of String variable ('target' in above example), you will get JANUARY.
Hope this answers first part of your question.
For converting this into Local language, I believe we have to leverage "Multi lingual" capability of the Salesforce. But haven't tried that myself yet. Hence can't provide a straight answer to that.
- Satgur
Thank you this has worked now I just need to figure how to use the "Multi lingual" capabilities