Hello.
I am using report.
In each field of the report there is datamethod.
I couldn't find something better, but I overrided on the datamethod, and put them a code that convert date to string.
the method I choose is strfmt, but I didn't find a way to convert to a specific format :
i.e dd/mm/yyyy.
How can I convert data field (of a table in database) to string with a specific format?
Thanks :)
*This post is locked for comments
Most of the parameters are enumerations. Try leaving most at auto and see if the format meets with your approval. For example:
strDate = date2str(thisDate, 321, DateDay::Auto, DateSeparator::Auto, DateMonth::Auto, DateSeparator::Auto, DateYear::Auto);
The sequence should indicate which parts of the date should be in which order, with 1 = days, 2 = months, and 3 = years. Some examples
123 = day / month / year
213 = month / day / year
321 = year / month / day
132 = year / day / month
etc.
EDIT: ah, beaten to the punch. Patrick is right though.
123 equal day-month-year
321 equals year-month-day
Means:
1 for day
2 for month
3 for year
I suggest you use it that way:
date2str(date, 123, 2, 4, 2, 4, 2);
What is the parameter : "Day". and where can I find information for the value, I should give (i.e : 321, for the link you gave) ?
Thanks :)
Try using the built-in function date2str() method.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156