Is there a CTL function for returning the day of the week either 0 - 6 (1 -7) or Monday, Tuesday, etc.? I see functions for returning the day of month, month, year, hour, minute, second, millisecond, etc. but not for day of the week. Anyone have a solution besides doing it in JAVA? I’d like a CTL solution if possible. Thanks.
Hello Pinwizard,
extracting the day of the week can be achieved by using the appropriate date format, typically:
-
“EEE” – this will return a 3 letter weekday name (‘Mon’, ‘Tue’, etc.)
-
“EEEE” – this will return the full weekday name (‘Monday’, ‘Tuesday’, etc.)
So basically, the only CTL function that you need is the date2str() function with the desired format definition that would convert a date in the date format into a string, for instance:
$out.0.dayOfWeek = date2str(2018-07-13, "EEEE");
Such transformation will output “Friday” as a string value.
Kind regards,