cryp
cryp

Reputation: 2375

Apache Pig Todate() function issue

I am converting a date string to datetime format in Pig using Todate function, but it is spitting out the wrong month.

input date = "2014-04-15 01:25:33.583Z" I am loading this as chararray
usage: ToDate(Timestamp,'YYYY-MM-DD HH:mm:ss.SSS')
output : 2014-01-15T01:25:33.583Z

Any idea as to why this could be happening.

Upvotes: 1

Views: 3646

Answers (2)

Jithin K J
Jithin K J

Reputation: 21

ToDate(Timestamp,'yyyy-MM-dd HH:mm:ss.SSS')

  • only month and hour format need to be in capital letter.

Upvotes: 0

Romain Jouin
Romain Jouin

Reputation: 4838

The issues lies on the string format : the YYYY and DD should be in lowercase, while the months should stay in uppercase !

cf : https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

Upvotes: 2

Related Questions