Skip to content

EST to EDT or CST to CDT Timezone Changes

March 16, 2010

Today i’ve noticed an interesting behavior in one of our application. We have soft switch running in EST timezone and we got the CDRs with date i.e ‘2010-03-14 02:03:44’. Our application is written in Java and we are using JODA date time library. When we try to enter that date in database our application got data truncation error why? because EST timezone has changed at ‘2010-03-14 02’ and it became ‘2010-03-14 03’ in EDT.

That means timestamp with a value of ‘2010-03-14 02:03:44’ is an invalid timestamp and JODA and MySQL both ignored that timestamp and raised errors.

The trick we did to resolve this error is we added one hour in our timestamp so that time which was before applying the change was ‘2010-03-14 02:03:44′, becomes ”2010-03-14 03:03:44’ after the change. And, it is a valid time in EDT so both JODA and MySQL didn’t raise any error and bug got fixed.

Advertisements

From → Programming

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: