When we want to store date to a string, what is the best way to do it with a date format ?
Can we use only STRFMT(), let say we want to add some text as well, like -> str sDate = strFmt(/Today is %1/, systemdateget()) but with addition of specifying date format like /DD-MM-YYYY/
or should we convert the date using Date2Str() function then use the result in strFmt() ?
Hard-coding a date format sounds like a bad idea in this case. You should respect the format used in the user session, otherwise the user will see different format in your message than in the rest of F&O. It looks weird and it may lead to errors, e.g. when the user uses the US format starting with the month, not the day.
But in general, date2str() is an option. I also like .NET formatting functions, where you can use format string such as dd-MM-yyyy. It's usually easier to understand.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.