This is another question on date string to datevalue conversion.
Input format is "March 17, 2013 7:04:28 PM GMT-07:00".
(Output of SAP tool)
=DATEVALUE(B26) fails.
Any chances?
Thanks,
Gert
This should work:
=DATEVALUE(LEFT(B26,FIND(",",B26)+5))+TIMEVALUE(MID(B26,FIND(",",B26)+7,FIND("GMT",B26)-FIND(",",B26)-8))
Your looking at two different things. Datevalue is seperate from time. For example, March 17, 2013 in Datevalue is equal to 41350.
=DATEVALUE(March 17, 2013)
Timevalue of 7:04:28 PM is equal to 0.794769
=TIMEVALUE(7:04:28 pm)
Both of these require the input to be in text format, not date or time.
You'll have to parse out the string and strip off the GMT at the end. I don't think excel can evaluate time zones.
If you are using US regional settings then your text is a valid date/time format once you remove "GMT" and everything after so you can use a formula that will simply remove that part and "co-erce" to a date/time value, i.e.
=LEFT(B26,FIND("GMT",B26)-1)+0
format result cell in the required date/time format, e.g. m/d/yy hh:mm
Related
The Format is Date
=INT() didn't work
Just because you format it as a date does not make it so. This is probably a date stored as text not a true date which if you changed to general format would change to a number. You will need to parse the string and put the "date" in a format that excel can understand then take the INT to get just the date:
=INT(--REPLACE(SUBSTITUTE(A1,",",""),FIND("{{{",SUBSTITUTE(A1," ","{{{",2)),0,","))
One note, this method only works if the month value like Feb is in the local language. If one has a local language of Portuguese Feb is not the correct abbreviation, and as such will fail.
Use the builtin date functions Day() Month() Year() Hour() Minute().
Trying to convert Italian date. I got dates from pdf like 21 Giu 2020 which I paste into Excel and then try to format cells and choose option "Date" and 14-mar-12 there but it does not respond. It does only when I change 21 Giu 2020 to 21.12.2020 then it is 21-giu-2020.
Is there any way to automate it, else I need to search upon Italian months and conver Ago to 08, Giu to 12 etc etc?
If your locale isn't Italian, I doubt that Excel would ever recognize a string like that as a date. Here is a formula that would create the date for you:
=DATE(RIGHT(A1,4),MATCH(MID(A1,4,3),TEXT(DATE(2020,SEQUENCE(12),1),"[$-410]mmm"),0),LEFT(A1,2))
The avobe usage of SEQUENCE requires ExcelO365. I also made the assumption your text is always in the pattern "dd mmm yyyy".
You'll end up with a date which you can then use number formatting of your liking.
I need to convert the below date format in excel.
Currently I have: Fri Jan 06 05:10:31 2017
Current Format : ddd MMM dd hh:mm:ss yyyy
I wanted to be in the following format: dd/mm/yyyy hh:mm:ss
You need to remove the day from the string, convert it to a number then format the way you want.
To do the first two steps use this formula:
=--MID(A1,5,LEN(A1))
The third is a custom format:
As per the comment:
Yet another approach:
=DATEVALUE(MID(A1,9,2)&MID(A1,5,3)&RIGHT(A1,4))
If you are running into trouble with regional DMY vs. MDY system settings, parse it out longhand so no interpretation is performed; i.e. give the conversion no options.
=DATEVALUE(REPLACE(MID(A2, 4, LEN(A2)), 8, 9, ","))+TIMEVALUE(MID(A2, 12, 8))
You can format it and everything from the formula bar (no need to go in and set formatting).
=TEXT(MID(A1,5,LEN(A1)),"dd/mm/yyyy hh:mm:ss")
I have dates coming out of a database into a column that have this format:
Column K
AUG-14-2015 08:31:32 AM
AUG-12-2015 06:10:03 PM
AUG-12-2015 05:17:51 PM
I want to add like '2.2' days to each of these and put them in Column L. I have formatted the column in this format:
mmm-dd-yyyy hh:mm:ss AM/PM
I wasn't sure if the dashes are causing the problem, but when I do a =K15+2.2 I get a !VALUE. Any ideas what I need to do? Thanks.
After some experimenting, it seems that while you can specify a date format "mmm-dd-yyyy hh:mm:ss AM/PM", the actual entry into the cells must be either a date in the system wide locale specific format, or a number of days since 1 January 1900.
So for example when you set a cell's format to custom:
"mmm-dd-yyyy hh:mm:ss AM/PM"
In my case (Windows 10 default UK locale settings, Excel 2010) for AUG-12-2015 06:10:03 PM, I can enter any of:
12/08/2015 06:10:03 PM
12/08/2015 18:10:03
42228.26
And also exchange the month 08 for Aug or AUG in any case and change the '/' for '-' in the dates.
For cells formatted "mmm-dd-yyyy hh:mm:ss AM/PM", the output for any of the above inputs is:
Aug-12-2015 06:10:03 PM
Note that there does not appear to be a means to force all-capitals for the month.
Note also that if you enter a date/time in the locale format it is automatically recognised and formatted as date/time.
So really your only option is to either change the format of the source data, pre-process the data into locale date/time format, or write a macro to do it within the spreadsheet. It may also work perhaps if you change your locale settings (System Settings, Language & Time), but that is perhaps less than satisfactory because it will affect date presentation for the whole system.
If you want to avoid VBA, then you can add a column("L") next to your data and enter:
=SUBSTITUTE(K1,"-","/")
Another solution would be to write code to do just that to your existing "K" Column
I have many strings of text preceded by a timestamp with the form
Oct 19, 2011, 5:00:40 AM GMT
I tried using isDate to check if some subset of the string is a Date, but the only section that seems usable is
Oct 19, 2011
and I would like to have the time data as well.
Thanks in advance!
I'm sure there are cleaner ways to do it but this might help you get by:
For Date value enter (shown in cell B2): =DATEVALUE(MID(A2,1,FIND(",",A2,FIND(",",A2)+1)-1))
For Time value enter (shown in cell C2): =TIMEVALUE(MID(A2,FIND(",",A2,FIND(",",A2)+1)+1,12))
Results: