Convert Date/Time Text String to Time Format - excel

I am running a report on a website that spits this out in a CSV format:
Thu May 07 2020 12:16:08 GMT+0000 (Coordinated Universal Time)
I want to convert it to a time format in Excel, ideally MM:SS (no hours needed). I need to be able to add/subtract two times.
Tried various formulas, but the string is so long I keep confusing myself. Can someone assist?

Consider:
=TIMEVALUE(MID(A1,FIND(":",A1)-2,8))
with the proper formatting.

Related

Convert date Excel

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.

Excel Date Time Formatting

I am trying to format a datetime so that Excel can read it. So far, I've been able to convert by separating the date from text to strings, but might there be an easier way to account for "EDT"?
Note that the EDT doesn't matter, as all the times are in "EDT". However, if there is timezone functionality, that would be great.
The string:
Wed Jul 01 02:57:58 EDT 2015
How I'd like Excel to read it, where the "."s represent text to ignore:
ddd mmm dd hh:mm:ss ... yyyy
Maybe:
=DATE(RIGHT(A1,4),MONTH(DATEVALUE(MID(A1,5,3)&"1")),MID(A1,9,2))+TIMEVALUE(MID(A1,12,8))
Pnuts formula works absolutely. I have couple more ideas which you can give a try,
=TEXT(RIGHT(SUBSTITUTE(A1,"EDT ",""),20),"mm/dd/yyyy")
This formula converts it to mm/dd/yyyy format.
However if you want to include time also, please try the below formula,
=TEXT(RIGHT(SUBSTITUTE(A1,"EDT ",""),20),"mm/dd/yyyy hh:mm:ss")
You can change the format in TEXT function as per your needs. Hope this helps.

How to change the date format that primefaces give with this calendar? [duplicate]

I've been searching all over and just can't find a explanation or reason why this is happening but the parse(String) method of DateFormat just isn't parsing my String correctly.
I'm trying to parse a String into the date format that is used for HTTP headers and got as far as getting the String on its own such as:
Thu, 11 Nov 2010 18:34:22 GMT
Which is in the format:
E, d MMM yyyy HH:mm:ss z
But when I use df.parse(dateStr); this is what I get out of it:
Thu Nov 11 18:34:22 GMT 2010
Which is nothing like what I wanted, why is the year now after the GMT? Why is there no comma anymore? And why is the date after the month?
I'm completely confused about this now and can't find a solution but I really need the date to be in that format. Is the comma messing things up? or the colons?
Thanks for your time,
Infinitifizz
P.S.
Forgot to mention this but I've tried dateformat.setLenient(false) and it makes no difference.
P.P.S
I'm trying to do this to compare the dates with date1.before(date2) and after() etc to see if one is newer than the other but I can't do this because the parsing isn't working.
Even though they look the same but just the format is different, they are not the same because after calling getTime() on both of them (When I have provided 2 identical dates) the longs are not the same. As in the date is:
Thu, 11 Nov 2010 19:38:52 GMT for a lastModified() on a File
If I input the String "Thu, 11 Nov 2010 19:38:52 GMT" and then compare their longs once converting the string to a date using parse() and then calling getTime() on that date I get:
lastModified = 1289504332671
fromString = 1289504332000
It is only the last 3 digits that are different, does this have any significance?
Thanks again for your time and sorry I didn't put this bit in first,
Infinitifizz
The result format is the default format of Date#toString() (click link to see the javadoc). You're apparently doing a System.out.println(date). You would like to use SimpleDateFormat#format() instead with another pattern to format it in the desired format. E.g.
String newDateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
Update: You shouldn't care about the format when using Date. You should only care about the format at that point when Date is to be converted (displayed) as String. As to the difference in timestamps, the Date uses millisecond precision for the timestamp while HTTP header uses second precision. You'd like to divide the timestamps by 1000 before comparing.

How to convert Excel date/time to epoch

I Googled and found a formula that is supposed to convert from Excel date/time to epoch time. However, it's off (or I'm off) and I can't figure out what I'm doing wrong. I'm using http://www.epochconverter.com/ as my source of truth.
So the link I found says the formula is:
=(A1-25569)*86400
I think 25569 is the Excel value for DATEVALUE("1-1-1970") but for some reason my version of Excel says that's 24107 so I made some modifications and typed:
=((A2-DATEVALUE("1/1/1970"))*86400 - 8*3600 (for PST)
Now the number is a little more correct. However, it seems like I need to ADD 8*3600 instead of SUBTRACT.
Can someone explain to me why?
I thought PST is -8 from GMT.
For the sake of an answer:
Your Excel is using the 1904 date system.
IF your Excel times start off as ‘local’ don’t adjust for time zone. IF they start as GMT (a concept Excel does not have) then, because when a GMT clock ticks on to 16:00 a ‘local’ clock should tick on to 08:00, from Excel to ‘local’ means deducting 8 hours. Note that midnight 31/12/1969 is not the same instant GMT as PST.

How to convert a date entered as a string to a Date type in Excel?

I have a large spreadsheet that contains, among other things, date entries in the form of:
Fri, 03 May 2013 07:04:46 GMT
I haven't been able to find a way, within Excel proper, to manipulate this down to a date object it recognizes. The problem is, I don't extract the spreadsheet or have any control over how this data is provided, and there are a LOT of entries -- to many to manually change them. Further, while my first thought is to simply crank out a Perl script to roll through and do it for me, this won't do because I'm just prototyping a process that will be handed off to someone that wouldn't know Perl from Pearl. It needs to be something doable only in Excel, and other than sorting and basic equations and such, I'm pretty much an excel noob.
My require is simply that I need to be able to sort the column contain these values as a date.
Thanks!
If there are specifically three characters for the month, then you could use:
=DATEVALUE(MID(A1,6,11))+TIMEVALUE(MID(A1,18,8))
Format the Cell to a Date, using something like dd/mm/yyyy hh:mm:ss if you want to confirm that the time is correctly interpreted.
If you don't need the time then just omit the +TIMEVALUE().
You can use =LEFT, =MID and =RIGHT to extract the different parts of the string, and manipulate them further. The string format isn't unambiguous from your example, but I'm assuming that it's 3-char weekday, dd mmm yyyy date, and hh:mm:ss time.
If your data is in column A:
=LEFT(A1, 3)
returns Fri
=MID(A1, 6, 11)
returns 03 May 2013, and =VALUE() on that returns the date serial number for 3 May 2013.

Resources