Visokio website     Downloads     Video tutorials     KnowledgeBase  
Date/Time: week formatting - Visokio Forums
Date/Time: week formatting
  •     mokirk March 8, 2012 11:53AM
    I have a text field with value 200901 (year followed by week) . When i convert it to date using texttodate(200901 ,"yyyyww"). It does not work and returns an error. When I use a different format it returns 29-Dec-2008 00:00:00. It does not like something about 200901.
  • 4 Comments
  •     chris March 9, 2012 6:28AM
    Hi,

    This is a fairly common issue (see: http://forums.visokio.com/discussion/808). The first week in January begins on Monday 29th December 2008, which is why you see this value.

    It does not show when you try and use the format "yyyyww" because Omniscope uses strict date checking. Because the year of the input date (2009) and the year of the output date (2008) are different the date is rejected.

    We may add in a "lenient" option to the field organiser in a future Omniscope release to get around this issue, but for now there is a simple solution: Simply create a formula field with the following formula. In the TEXTTODATE function you can set "lenient" to true, as follows:

    TEXTTODATE([DateWeek], "yyyyww", true)

  •     mokirk March 9, 2012 7:26AM
    Hi Chris,

    When I used your formula and set leniency to true. It comes up with the following error


    "Error with result for record 1: Cannot store value in a date field: 29-Dec-2008 00:00:00 Date not legal for date format"

    Please see attached file
  •     chris March 9, 2012 8:30AM
    Unfortunately you can't use the date format "yyyyww". This is because applying this date format will result in a date of "200801" which is inconsistent with the original date "200901". This is what the strict date checking does and is why you can encounter problems when working with dates in this format.

    To resolve this problem you must use a date format such as "dd/MM/yyyy" on the formula field. You might also want to consider creating a separate "year" and "week of the year" field.
This discussion has been closed.
← All Discussions

Welcome!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership