Find the Week_of_Year

I'm not sure, but Date in Knime are ?!!@@#@#° !!

How to find the Week from a string or from a date

Simple but I'm trying for 2 days (!) with Calendar, String to Date, Gregorian,.....

 

;-)

MitchP

2 days are long (long is also a date).

How about converting the string to a date column ("String to Date/Time") and then using the  "Time to String" node to extract the week. It should be a simple 'w'. The node description to the Time to String node has all the important ones. Here is a copy:

Valid pattern elements are:

  • G: era designator
  • y: year
  • M: month in year
  • w: Week in year
  • W: week in month
  • D: Day in year
  • d: day in month
  • F: Day of week in month
  • E: day in week
  • a: Am/pm marker
  • H: hour in day (0-23)
  • k: hour in day (1-24)
  • K: hour in am/pm (0-11)
  • h: hour in am/pm (1-12)
  • m: minute in hour
  • s: Second in minute
  • S: millisecond
  • z: Timezone (General time zone)
  • Z: RFC 822 time zone

Many, many many thanks.......

I saw that listing on "String to Date" but didn't try with "Time to String".....

and the retuned week is based on US Calendar....

All the best, wiswedel

yes

Does the String to Date/Time node only extract date elments, or can it introduce them if they are not present?  So can you say extract week in year from "yyyy.MM.dd" or does the the week element need to present before it can be transformed to "yyyy.ww"?

All the best,

Mark

Hi Mark,

 

After transforming string to Date "String to Date/Time, dd.MM.yyyy", select the "Preset Date/Time" node with "replace missing value", and after extract the Week with "Time to String, w" node.

 

;-)

MitchP

Works like a charm.  Thank you for your help.