Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel default date time format yyyy-mm-dd hh:mm:ss versus yyyy-mm-dd hh:mm

Tags:

excel

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

like image 493
ssinfod Avatar asked Jul 18 '15 13:07

ssinfod


People also ask

What is the default format of date and time in Excel?

Excel default date time format yyyy-mm-dd hh:mm:ss versus yyyy-mm-dd hh:mm.

How do you find the difference between dates in Excel mm/dd/yyyy hh mm ss AM PM?

Either use =DATE()+TIME() or write dates in separate cells and use references in your formula like =TEXT(A1-A2,"h:mm") .

How do I change the default time format in Excel?

On the Home tab, in the Number group, click the Dialog Box Launcher next to Number. You can also press CTRL+1 to open the Format Cells dialog box. In the Category list, click Date or Time. In the Type list, click the date or time format that you want to use.


2 Answers

in 'format Cells -> custom' write

yyyy-mm-dd h:mm:ss;@ 

in the Type box

like image 176
Jose Cabrera Zuniga Avatar answered Oct 23 '22 13:10

Jose Cabrera Zuniga


It is completely depend on your system date and time format:

  1. Go to Control Panel,
  2. Click on "Region and Language",
  3. Click on "change date, time and number format"
  4. Set "short date", "long date", "short time" and "long time".
like image 21
user2557924 Avatar answered Oct 23 '22 14:10

user2557924