How to convert week part of date correctly?



  • Official comment
    Saurabh Agashe

    Datameer uses Joda time. Full documentation for Joda time is available here: In your example, you'll want to reference the year in conjunction with the week. The key-code for this is an "x" character instead of a "y" character.

    In the context above, please use this function: AsDate("2014-01";"xxxx-ww") which results in Dec. 29, 2013.

    Additionally, here are the conversions for the other examples that you've provided: FormatDate(AsDate("01/01/2016";"MM/dd/yyyy");"xxxx-ww") results in 2015-53 FormatDate(AsDate("01/01/2012";"MM/dd/yyyy");"xxxx-ww") results in 2011-52

    I hope this helps!

    Comment actions Permalink
  • Saurabh Agashe

    Thank You. This works!

    Comment actions Permalink
  • Gido

    Since other customers were asking for such kind of functionality too, I've created a separate knowledge base article for how to extract the calendar week from a date-input-field

    Comment actions Permalink

Please sign in to leave a comment.