Get current date with MonthName
I'm trying to print today's date at the top of a report in a format that spells out the month. I could do this with a data layer that selects sysdate from dual, but I would rather save the database call and use Logi functions. I know how to use logi functions to print the date as 01/10/2022 and 2022/01/10, but I'm looking for the value to put on a label that will give me:
January 10, 2022
MonthName() works fine if I feed it the month, but my syntax is wrong trying to get he monthname with this: =MonthName(=Month()). Setting a separate session variable to =Month() and then using =MonthName(@Session.month~) is also failing because of something syntax related.
-
Hey Scott,
The Format attribute of the Label allows you to customize the layout in any number of ways. It sounds like you want "MMMM dd, yyyy" (from MS Documentation of VB Date Formats).
Here is the label as it would be configured in Logi Info:
<Label
Caption="2022-04-20"
Format="MMMM dd, yyyy"
/>Results in April 20, 2022
Simply place your Date Token into the Caption field and set the Format to MMMM dd, yyyy.
Regards,
Johnny0 -
What about something like
<Label
Caption="@Date.Today~"
Format="Long Date"
/>
I believe the formats are borrowed from .net so you could probably do a quick search and find the format to drop the leading name of day.
0 -
Thanks. Your solution worked perfectly!
0
Please sign in to leave a comment.
Comments
3 comments