function for returning day of week in CTL

Support/help with CloverETL implementation problems

Pinwizard
Posts: 2
Joined: Thu Mar 17, 2016 2:19 pm

function for returning day of week in CTL

Postby Pinwizard » Wed Jul 11, 2018 6:09 pm

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.

bartonv
Posts: 80
Joined: Wed May 03, 2017 12:10 pm

Re: function for returning day of week in CTL

Postby bartonv » Fri Jul 13, 2018 10:06 am

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:

Code: Select all

$out.0.dayOfWeek = date2str(2018-07-13, "EEEE");

Such transformation will output “Friday” as a string value.

Kind regards,
---
Vladimir Barton
CloverCARE Support
CloverETL | Rapid Data Integration

Visit us online at http://www.cloveretl.com
How to speed up communication with CloverCARE support


cron