Apache PIG - 将毫秒转换为 TimeStamp Unix

Apache PIG - Convert millseconds into TimeStamp Unix

我有以下字段:1388481000000 作为从 Unix 纪元(1970-01-01 UTC)开始经过的毫秒数

如何转换为 Unix 时间戳? 我正在尝试使用:

ToUnixTime(1388481000000,'dd/MM/yyyyHH:mm:ss','GMT')

但它给我错误...

如何转换成 Unix 时间戳?非常感谢!

你把事情搞混了。ToUnixTime syntax is ToUnixTime(datetime) where the parameter is a datetime object.What you have is the milliseconds elapsed from the Unix epoch (1970-01-01 UTC).I assume you are trying to convert the milliseconds to a datetime object for which you will have to use ToDate 语法是 ToDate(milliseconds)。

ToDate(1388481000000)