我正在使用spark-csv读取CSV文件,其中一列是时间戳,其值如下
Aug-02-2016 04:12:03:232 PM (CEST)当然,这是相当不标准的,所以我必须使用spark-csv选项
dateFormat: specifies a string that indicates the date format to use writing dates or timestamps. Custom date formats follow the formats at java.text.SimpleDateFormat. This applies to both DateType and TimestampType. If no dateFormat is specified, then "yyyy-MM-dd HH:mm:ss.S".如何指定此格式?
我试过了
'mm-dd-yyyy HH:mm:ss.S PM (CEST)' 没有成功。
发布于 2016-08-21 22:52:35
您应该参考SimpleDateFormat文档,了解您可以指定的格式。
在您的情况下,我认为应该是这样的:
String format = "MMM-dd-yyyy hh:mm:ss:SSS a (z)"https://stackoverflow.com/questions/39065413
复制相似问题