保证被 Excel 识别的日期格式 [英] Date format that is guaranteed to be recognized by Excel

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

问题描述

我们正在以各种格式导出分析报告,其中包括 CSV.对于某些客户来说,这个 CSV 可以进入 Excel.

We're exporting our analytics reports in various formats, among them CSV. For some clients this CSV finds it's way into Excel.

在 CSV 文件中,其中一列是日期,例如

Inside the CSV file one of the columns is a Date, for example

"Start Date","Name"
"07-04-2010", "Maxim"

Excel 无法解析这种日期格式,这显然取决于用户的语言环境.07"是日还是月...

Excel has trouble parsing this date format, obviously depending on the Locale of the user. Is "07" is the day or the month...

您能否为 Excel 解析不会遇到问题的日期字段推荐一些文本格式?我的目标是尽可能安全的选择.我会接受一些转义序列,这将导致 excel 完全避免解析列中的文本.

Could you recommend some textual format for a Date field that excel will not have trouble parsing? I'm aiming at the most fail safe option possible. I would settle for some escape sequence that will cause excel to avoid parsing the text in the column altogether.

感谢您的帮助,马克西姆.

Thanks for helping, Maxim.

推荐答案

你有两个选择.将月份作为字符串,将年份作为 4 位数字,或使用 ISO 格式:yyyy-mm-dd.

You have two options. Go with the month as a string and the year as 4 digits, or use ISO formatting: yyyy-mm-dd.

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

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