Search code examples
sqlderbyjavadb

Week of year of a timestamp using derby/JavaDB


I need to know the week of year of a timestamp using Derby/JavaDB. And to make it worse I have to extract it from a parameter not a column. Don't ask why but that should be a minor problem.

On DB2 I say someting like

VALUES WEEK_ISO(?)

But how do I get the same result with Derby aka JavaDB?


Solution

  • Thanks Bryan, your Link was very helpful.

    http://therealdanvega.com/blog/2010/02/17/creating-apache-derby-custom-functions-part-2

    It seems there is no week function in derby but it is very easy to program such a function yourself. Especially when you use it from Java.