|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
calculate week number |
« View previous topic :: View next topic » |
Author |
Message
|
souciance |
Posted: Tue Jun 29, 2010 6:24 am Post subject: calculate week number |
|
|
Disciple
Joined: 29 Jun 2010 Posts: 169
|
Hello,
I would like to know if there is any way to calculate the ISO week number based on a given date using ESQL? The normal ESQL EXTRACT function does not give the ISO week number. Anyway done this before?
BR
Moeed |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 29, 2010 7:02 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
What basis is the ISO week number calculated on? EXTRACT will give you weeks since January 1 or the week of the year.
CAST gives you additional options...
If none of these give the exact ISO definition, you should be off by no more than one week in a specific direction, and thus can adjust with basic arithmetic... ? |
|
Back to top |
|
 |
souciance |
Posted: Thu Jul 01, 2010 10:10 am Post subject: |
|
|
Disciple
Joined: 29 Jun 2010 Posts: 169
|
mqjeff, true I can use arithmetic but this seems like a bad solution for critical integrations.
Is there no way to configure the broker to use ISO date standard? |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jul 01, 2010 10:42 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You asked very specifically about the ISO "week number".
I don't know what *ISO* thinks is the "week number", nor do I know what you think of as the "ISO week number".
Broker supports two different notions of the "week number". One is the number of weeks since January 1 of the year, and one is the number of weeks since January 1 in the year 0001. The first should never be more than 1 different from whatever ISO considers as the "week number", or may always be equal to it.
The documentation on the CAST function has a full page discussion of how to convert from datetimes to strings.
One mention in there is the discussion of the "I", and "T" as formats for a restricted profile of ISO8601. This discussion may provide some enlightenment for you in terms of the support you're looking for.
In addition, there are any number of other ways that you, as a user, can "add" support for ISO week numbers to Broker - including something as straight forward as building a JavaCompute or PHPCompute node that calls out to a date-time library that you "trust" more than you trust basic arithmetic for critical integrations. |
|
Back to top |
|
 |
fatherjack |
Posted: Fri Jul 02, 2010 1:55 am Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
mqjeff wrote: |
I don't know what *ISO* thinks is the "week number", nor do I know what you think of as the "ISO week number". |
FYI this is what I think ISO week number is:
"a week starts on a Monday and week 1 of a given year is the one that includes the first Thursday of that year or in other words it is the week that includes 4th Jan."
HTH _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|