I generated a report that formats date as 20160509 and my Google Sheets locale is already set to United States. I've played around with various options within Format > Number > Date Format but I can't change the dates to MM/DD/YYYY format without doing a simple find and replace. How do I accomplish this?
Assuming your string is in cell A1, this formula will convert it to a date. You can then format the date however you prefer.
Or, take the leftmost four characters as the year, the rightmost two characters as the day, and two characters in the middle starting at position 5 as the month, and convert it to a date.
(standard American date format)
From Google Support:
This is what I use in my helper column using the inbuilt google sheets function:
This is also what I use when I need put a date string as the part of a filename:
datevalue() accepts any date string format including the excel raw date numbers that you have on your 1st column.
TO_DATE() converts the
datevalue() to something lawyers can read. The outer function
Text(,"") allows you to modify the date format.
I use it to return integers that can be used in formulas dealing with dates on google sheets.
The how: Those raw numbers on your 1st column? 1 is January 1st 1900. 2 is January 2, 1900 ..and so on...
In google sheets, each cell on your column is equal to the number of days after December 30, 1899, [post-gilded age, when the U.S. became a corporate state under admiralty law and issues public policies instead of common law, meaning no one is supposed to harm you unless you agree to waiving your rights].
to_date()converts that raw date value to a format more recognizable.
The function is equivalent to clicking on the taskbar
time from the menu bar.
As a side note:
=Text(TO_DATE(DATEVALUE(A1)),"MM-DD-YYYY)" in a helper column is what I use to convert any date string into a string format usable for windows file names since
/ is not accepted for windows file naming. No need to worry if the date has a missing leading zero.
Here is the formula for the one of you trying to convert a date were the 0 would have been removed:
=date(right(J5,4),if(mid(J5,2,1) = "/",left(J5,1),left(J5,2)),if(mid(J5,3,1) = "/",mid(J5,4,if(mid(J5,5,1) ="/",1,2)),if(mid(J5,2,1) = "/",mid(J5,3,if(mid(J5,5,1) = "/",2,1)))))
In this case I'm going from American to European: M/d/yyyy, MM/d/yyyy, MM/dd/yyyy or M/dd/yyyy and convert it to dd/MM/yyyy
Click the gear icon on the right from your main Google Drive dashboard and select Settings. If you don't have a language selected you can set it here. This should apply to all future documents.
Either you can change the default calendar setting for google doc as follows:
File > Spreadsheet settings > Change locale or Timezone