pub.date:GetCurentDateString retrunign wrong date all of a sudden

Hi, pub.date.getCurrentDateString is returnign wrong date 2016 as year ; all of a sudden.
Any idea why this would happen ? Its Webm 8.2 for us. in prod, please give some speedy input.

Thanks,
Priya

Hi – What did you give as part of Pattern input field ?

Thanks,

which OS you are using, try to get date from that OS.

Thanks,

Its UTC. But its a part of the existing code.
Its giving 2016 even in other patterns like EST.
All of a sudden at EST 7 PM,yesteday this started to happen.

also, did you give hard coded value as part of patten having 2016 as a value.

Thanks,

OS is linux,how can I get a datw from the OS. I heard that the java was updated recently in d env

Connect to Linux through putty console, type date command which gives output. Please share the same.

Thanks,

No 2016 was not given as hard code for year yyyy.
This code was working fine since months. All of a sudden we started getting 2016 in pb.date.getCurrentDateString service

Did you try the above step which I shared. Kindly update me soon.

Thanks,

Also, share the screen shot of service inputs which you used.

Thanks,

OS date is

$ date
Sun Dec 27 03:27:20 EST 2015

I gave pattern : yyyy-MM-dd hh:mm:ss
Timezone : UTC

I request you, if you have business persmission, just give a restart. I don’t think any other problem exist as OS is giving you right details.

Thanks,

On OS, can you plz issue uname -a command and share me the output.

Thanks,

Try Timezone : GMT

Kindly share more details about your JVM upgrade?

Priya – Any update on this ?

Thanks,

Out of couriosity: what is the rationale behind this question/recommendation? If the service gives the wrong year, this can’t be because of a wrong timezome (as of today) IMO. So I’m courious about what you wanted to find out by your question (I’d like to be able to solve similar problems in the future myself).

Thanks!

Hi All,

Extremely sorry for the late reply.
We seem to have found the real issue.

So, it happens the year patter in the code was YYYY.

YYYY - Year at the end of the week cycle. So the moment we arrived at the last week of the year in UTC timezone, we got the value 2016 since weekend was 02-01-2016.

Earlier, even we had considered restarting and jvm issues … but the search came in the right time.

So, we reverted to pattern yyyy.

Also, in jvm 1.5 YYYY is not an accepted pattern.

Turned out an interesting catch and learning:)

Thanks all for quickly jumping in for help.

Appreciate it.

Thanks,
Priya

Yes, it is really an interesting issue, glad to hear issue got resolved and thanks for updating the thread.

Thanks,

Hello All,

The rationale behind this is to check and confirm the output for the below combination, this is just a test case or (try and error) to see the problem was with the JVM upgrade or the input pattern itself:

pattern : yyyy-MM-dd hh:mm:ss
timezone : GMT

During the start of this topic, I had an impression the issue could be with the year pattern (YYYY) but the user confirmed the input pattern to be “yyyy-MM-dd hh:mm:ss”.Hence the problem was found and rectified.

For information, Java’s SimpleDateFormat class does not handle a capitalized YYYY properly and we had faced a similar case earlier.