|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
timestamp casting issue |
« View previous topic :: View next topic » |
Author |
Message
|
oyoz |
Posted: Tue Dec 09, 2014 8:23 pm Post subject: timestamp casting issue |
|
|
Newbie
Joined: 06 Feb 2014 Posts: 1
|
Hi all.
I'm using WMB7. I found some issue when casting time format using this ESQL :
DECLARE sourceDate CHAR '2014-12-28';
DECLARE resultDate CHAR CAST(CAST(sourceDate AS TIMESTAMP FORMAT 'YYYY-MM-dd') AS CHAR FORMAT 'YYYYMMdd');
when the month is 12 and date around 28 until 31, the year in resultDate will be increased by 1 (eg: 2014-12-28 become 20151228), but its not occur in other month.
does anyone have same issue as I am, or maybe a solution
thank you. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Dec 09, 2014 11:43 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
There is a documented restriction for the 'YYYY' representation of the year.
If you change it to 'yyyyy' then you should see the problem go away.
From the V7.0.0.4 InfoCentre.
Quote: |
The start of a year typically falls in the middle of a week. If the number of days in that week is less than the value specified by the physical message set property Days in First Week of Year, the week is considered to be the last week of the previous year; in this case, week 1 starts some days into the new year. Otherwise, the week is considered to be the first week of the new year; in this case, week 1 starts some days before the new year. For example, Monday of week 1 in 2004 (2004 01 Monday, where Days in First Week of Year = 4 and First Day of Week = Monday ) using format string YYYY ww EEEE is in fact 29th December 2003. If you use Y, the day of week (E) and week in year (w) are adjusted if necessary to indicate that the date falls in the previous year.
If you use the lowercase y symbol, the adjustment is not done and unpredictable results might occur for dates around year end. For example, if the string 2002 01 Monday is formatted:
Monday of week 1 in 2002 using format string YYYY ww EEEE is correctly interpreted as 31st December 2001
Monday of week 1 in 2002 using format string yyyy ww EEEE is incorrectly interpreted as 30th December 2002
Use Y together with w only; if you do not specify w, use y.
|
_________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
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
|
|
|
|