1

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.

user7337271
  • 1,662
  • 1
  • 14
  • 23
cryp
  • 2,285
  • 3
  • 26
  • 33

2 Answers2

2

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

Romain Jouin
  • 4,448
  • 3
  • 49
  • 79
0

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

  • only month and hour format need to be in capital letter.
Jithin K J
  • 11
  • 3