CSV日期格式问题 [英] CSV date Format problem

查看:807
本文介绍了CSV日期格式问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我在.csv文件中使用日期时,创建了一个问题,例如我使用了01/01/2011,这需要2011年1月1日,这是正确的,但是当我使用01/10/2011时,它将它视为1月10日. 2011.我的意思是说它总是采用mm-dd-yyyy格式.我有一些文件要转换为csv.当我转换这些文件时,文件中的日期为dd-mm-yyyy格式.转换后值会完全更改.因此,如何解决此问题?希望我明确了我的要求.在此先感谢plz提供了一些解决方案.
问候,
Snehasis

解决方案

文件格式错误并不多,因为您读错了.查看您如何读取数据-由于您没有告诉我们,我们无法提供具体信息-您需要查看将日期转换的语言环境设置为用于生成数据的格式.如果可能,请更改生产者和阅读者以使用ISO格式:yyyy-MM-dd HH:mm:ss,因为无论使用何种实际日期,都可以清楚地使用哪种格式.


Hi,

When i am using date in a .csv file it creats a problem as like i have used 01/01/2011 it takes 1st jan 2011,that''s right but when i use 01/10/2011 it takes it as 10th jan 2011.I mean to say it always takes in mm-dd-yyyy format.I have some gb of files are there to be converted into csv.When i am converting these files dates in the files are in dd-mm-yyyy format.And after conversion the value changes completely.Hence How to resolve this issue?Hope i made my requirement clear.Thanks in advance plz provide me some solution.

Regards,
Snehasis

解决方案

It''s not so much that the file format is wrong, as you are reading it wrong. Look at how you read the data - since you don''t tell us, we can''t help with specifics - you need to look at setting the Locale for the date conversion to the format used for producing the data. If possible, change the producer and the reader to use ISO format: yyyy-MM-dd HH:mm:ss as it is then obvious which format is used, regardless of the actual date.


这篇关于CSV日期格式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆