Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagegroovy
def date = api.parseDate("yyyy-MM-dd", "2018-01-24")
def week = api.getDatamartContext().calendar().getWeek(date)
return week

Similarly, other time dimensions such as Month, Quarter and Year can be retrieved by getMonth(date), getQuarter(date) and getYear(date) methods respectively. 

Warning

These functions (getWeek(), ...) always return values from Gregorian calendar and are always formatted in the default way. In other words, these functions do NOT use data from the cal Data Source. If you need the actual data from the cal table, you need to make a query to that Data Source.

...