CSV日期格式 [英] CSV date format

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

问题描述

我有一个VB应用程序,提取数据并创建3个CSV文件(a.csv,b.csv,c.csv)。然后,我使用另一个Excel电子表格(import.xls)将上述CSV文件中的所有数据导入到此工作表中。

I have a VB application which extracts data and creates 3 CSV files (a.csv, b.csv, c.csv). Then I use another Excel spreadsheet (import.xls) to import all the data from the above CSV files into this sheet.

import.xls文件有一个宏, CSV文件,并复制数据。我面临的问题是CSV文件中的日期存储为mm / dd / yyyy,并将其复制到Excel工作表。但我想要日期格式为dd / mm / yyy。

import.xls file has a macro which opens the CSV files one by one and copies the data. The problem I am facing is the dates in the CSV files are stored as mm/dd/yyyy and this is copied as is to the Excel sheet. But I want the date in dd/mm/yyy format.

当我手动打开任何CSV文件时,日期显示格式正确(mm / dd / yyyy)。

When I open any of the CSV files manually the dates are displayed in the correct format (mm/dd/yyyy). Any idea how I can solve this issue?

推荐答案

您可以使用格式 VBA函数:

You can use the Format VBA function:

Format(DateText, "dd/mm/yyyy")

这将格式化你喜欢什么。

That will format it how ever you like.

对于更永久的解决方案,请尝试更改您的区域设置Windows本身,Excel使用它的日期格式。

For a more permanant solution, try changing your regional settings in windows itself, Excel uses this for its date formatting.

开始 - >设置 - >控制面板 - >区域选项。

Start -> Settings -> Control Panel -> Regional Options.

确保语言设置为适当的设置,日期设置为您希望的日期

Make sure that the language is set to whatever is appropriate and that the date settings are as you want them to be

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

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