I'm using Excel 2010 or Excel 2007 to import CSV file with date/time information. The time stamp in my CSV file have the following format: yyyy-mm-dd hh:mm:ss. (ex: 2015-07-17 12:34:56)
My problem is that Excel seems to auto-detect that the field is a date/time and it is removing the second. Therefore it shows my data as: "2015-07-17 12:34" without the second. Then, when I save my file again in CSV the second are discarded and not present in the CSV anymore !
I find it very time consuming to change the custom cells format of all my files from "yyyy-mm-dd hh:mm" to "yyyy-mm-dd hh:mm:ss".
Is there a way to change the default date/time format in Excel setting or Windows registry?
What is the best (correct) way to force Excel to keep the second when I open and save a CSV file with data/time information in it.
Thanks, ssinfod
in 'format Cells -> custom' write
yyyy-mm-dd h:mm:ss;@
in the Type box
It is completely depend on your system date and time format:
If you open a CSV file, the seconds are not dropped, they are hidden by the default:
If double-clicked will result in:
If you then save the Excel as CSV , the seconds will be dropped. To save these seconds, you must reformat the cells as:
yyyy-mm-dd hh:mm:ss
before doing the SaveAs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.