I have collected some details from sql and it shows a birthdates as following (each line represents a different birthdate):
-294022800
649119600
-138675600
49158000
32396400
631152000
-2147483648
731894400
-408067200
522025200
I was trying to change them in excel using this formula:
=DATE(INT(A1/10000),INT((A1-10000*INT(A1/10000))/100),A1-(100*INT(A1/100)))
But it didnt work well, it must be in different format. Do you know what sort of format it is and how to convert it to date in excel? why some of numbers are negatives?
Can this be the EPOCH format? how to change it to normal human date in excel?
My guess would be that they are unix timestamps http://en.wikipedia.org/wiki/Unix_time
In excel, you can use something like:
=(((A1/60)/60)/24)+DATE(1970,1,1)
Although, you will have to watch out for the fact that your datetimes seem to include daylight savings offsets. (Some of them are multiples of a day (24*60*60), but others are an hour out). I'm not sure why you have a non-hour multiple in there (-2147483648), possibly some quirk of the original system.
Source: http://spreadsheetpage.com/index.php/tip/converting_unix_timestamps/
Unix timestamps can be converted with this formula
=A1/86400+DATE(1970,1,1)
The Unix timestamp is seconds since 1/1/1970 so birthdates before then would be negative. [one of the birthdates translates to 1901 - is that right? You'll have problems if any of the dates are before 1900 because Excel doesn't recognise those dates]
ok, I figured it out. This is the formula:
=(A1-(4*3600))/86400+25569
Related
I've been struggling with Excel (2016) date formats. I know how to change display formats for dates and cells but the problem I have is the input format for dates. If I input a date as "DD.MM" or "DD.MM.YYYY" it does recognize it as a date but if I input the date as "DD.MM." (with the second dot after the month), Excel does not recognize it as a date anymore. The column in question is formatted as short date.
Is there anything that can be done or is this by-design? If so, it seems really strange as at least in my country it's the official way to write the date containing that second dot after the month number when there is no year included in the date.
I've been searching and Googling for solution but couldn't find anything on this really. I appreciate all comments and help regarding this question!
SUMMARY/TL;DR:
Excel version is 2016, country is Finland and language is finnish
Excel accepts/recognizes these as dates: 12.5 or 30.8
Excel does NOT accept/recognize these as dates: 12.5. or 30.8.
The column in question is formatted as short date
The dot after the month seems to be screwing things up
Why is this happening? Can anything be done?
Kind regards,
Tenttu
Yes, it is/was by design. (Funny enough, my Excel won't allow dots, only dashes (-), so I couldn't even test if "15.8" works)
So, there's a slight chance that the language of Excel (the defaults of time (24 hours or AM/PM), dates (MM/DD or DD/MM), decimals (comma or dot) etc.) wouldn't allow the dot at after the month. Here's an example of a user that has that dot, and wants to get rid of it. So, your system language is a good candidate for why this wouldn't work for you.
However, I realize that the example linked above don't feature a date with a dot at the end. Which could suggest it is rather by design. For example, if I add a dot to a valid date or time, it will result in some #VALUE!-error. And that's because of how Excel is programmed to convert text to a date - and remember, dates are actually just really large numbers. So, adding a dot at the end makes that conversion "impossible". We might think it's as easy as to remove a dot, but in programming, we need to program that explicitly to do that, and I'm leaning towards there is no such operation done during text to date conversion (certainly not on my system, as I get #VALUE!).
One work-around is to strip the ending dot from the date to make it a valid date. So, you can import sheets with dates with dots at the end, then strip them away, and you'll be good to go!
I am pulling Cross Country race times, and trying to convert the race time into an integer that can be easier to work with.
I am using the formula
=([Cell Name]-INT([Cell Name])*60*24
But I am so far retrieving two different time formats:
17:23.4
15:09
Both formats take that formula differently, and they are producing different numbers. The first format is changed into 17 minutes, but the other is turned into 1000+ minutes. Is there a way that I can convert these times into one format?
The main problem you are having is as tom sharpe pointed out is that some times are being assessed as HH:MM and others as MM:SS. if you look at your source data cell (assmue A2) and use the following formula it will tell you if you are dealing with text or time in excel serial date time formatted to appear in a manner we are used to seeing:
=ISTEXT(A2)
now assuming that the result is TRUE, this means you are dealing with TEXT. Adding a leading 0: to the text will make the time recognizable to excel as being in the format HH:MM:SS and allow for you to deal with it consistently.
To do this use the following formula:
=timevalue("0:"&A2)
Things may get a little wonky if ou have anything greater than or equal to 60 as the first two digits.
once you have it in the proper format you can then use it in your formula.
Trying to convert 1504865618099.00 Unix time into a readable date time.
I tried this:
=(UNIX + ("1/1/1970"-"1/1/1900"+1)*86400) / 86400
But it's not working.
To convert the epoch(Unix-Time) to regular time like for the below timestamp
Ex: 1517577336206
First convert the value with the following function like below
=LEFT(A1,10) & "." & RIGHT(A1,3)
The output will be like below
Ex: 1517577336.206
Now Add the formula like below
=(((B1/60)/60)/24)+DATE(1970,1,1)
Now format the cell like below or required format(Custom format)
m/d/yyyy h:mm:ss.000
Now example time comes like
2/2/2018 13:15:36.206
The three zeros are for milliseconds
=A1/(24*60*60) + DATE(1970;1;1) should work with seconds.
=(A1/86400/1000)+25569 if your time is in milliseconds, so dividing by 1000 gives use the correct date
Don't forget to set the type to Date on your output cell. I tried it with this date: 1504865618099 which is equal to 8-09-17 10:13.
TLDR
=(A1/86400)+25569
...and the format of the cell should be date.
If it doesn't work for you
If you get a number you forgot to format the output cell as a date.
If you get ##### you probably don't have a real Unix time. Check your
timestamps in https://www.epochconverter.com/. Try to divide your input by 10, 100, 1000 or 10000**
You work with timestamps outside Excel's (very extended) limits.
You didn't replace A1 with the cell containing the timestamp ;-p
Explanation
Unix system represent a point in time as a number. Specifically the number of seconds* since a zero-time called the Unix epoch which is 1/1/1970 00:00 UTC/GMT. This number of seconds is called "Unix timestamp" or "Unix time" or "POSIX time" or just "timestamp" and sometimes (confusingly) "Unix epoch".
In the case of Excel they chose a different zero-time and step (because who wouldn't like variety in technical details?). So Excel counts days since 24 hours before 1/1/1900 UTC/GMT. So 25569 corresponds to 1/1/1970 00:00 UTC/GMT and 25570 to 2/1/1970 00:00.
Now if you also note that we have 86400 seconds per day (24 hours x60 minutes x60 seconds) and you will understand what this formula does: A1/86400 converts seconds to days and +25569 adjusts for the offset between what is zero-time for Unix and what is zero-time for Excel.
By the way DATE(1970,1,1) will helpfully return 25569 for you in case you forget all this so a more "self-documenting" way to write our formula is:
=A1/(24*60*60) + DATE(1970,1,1)
P.S.: All these were already present in other answers and comments just not laid out as I like them and I don't feel it's OK to edit the hell out of another answer.
*: that's almost correct because you should not count leap seconds
**: E.g. in the case of this question the number was milliseconds since the the Unix epoch.
If you have ########, it can help you:
=((A1/1000+1*3600)/86400+25569)
+1*3600 is GTM+1
in case the above does not work for you. for me this did not for some reasons;
the UNIX numbers i am working on are from the Mozilla place.sqlite dates.
to make it work : i splitted the UNIX cells into two cells : one of the first 10 numbers (the date) and the other 4 numbers left (the seconds i believe)
Then i used this formula, =(A1/86400)+25569 where A1 contains the cell with the first 10 number; and it worked
You are seeing the date as ######## most likely because by definition the EPOCH times is in seconds - https://en.wikipedia.org/wiki/Unix_time. This means the number should be 10 characters long. Your number has 13 characters (see 1504865618099) and it is most likely in milliseconds (MS). In order to fix the formula just divide the number by 1000. Just keep in mind this way you'll loose the MS precision, but in most cases this is OK. So the final formula should be:
=A1/(86400 * 1000) + DATE(1970,1,1)
Just point and shoot.
Replace the C2 with your cell no. No need to format your Excel cell.
Also, you can use this unixtimestamp website to verify your data.
International format (ISO 8601):
=TEXT(C2/(1000*60*60*24)+25569,"YYYY-MM-DD HH:MM:SS")
2022-10-20 00:04:22
2022-10-20 00:05:20
2022-10-20 00:14:58
US format:
=TEXT(C2/(1000*60*60*24)+25569,"MM/DD/YYYY HH:MM:SS")
10/20/2022 00:04:22
10/20/2022 00:05:20
10/20/2022 00:14:58
Europe format:
=TEXT(C2/(1000*60*60*24)+25569,"DD.MM.YYYY HH:MM:SS")
20.10.2022 00:04:22
20.10.2022 00:05:20
20.10.2022 00:14:58
If you only need the date, remove the 'HH:MM:SS'.
=TEXT(C2/(1000*60*60*24)+25569,"YYYY-MM-DD")
Essentially I have two timestamps as YYYY/MM/DD hh:mm and I want to find the time elapsed in days.
Excel can do this either with just time or just the date but not when the two are combined. I realize that this is not an uncommon timestamp format, and there is probably some way to calculate this simply with Excel functionality.
Any help would be appreciated :)
This is a duplicate of several questions in the past - so if someone wants to look for one of those and flag this question as a duplicate - that would probably be appropriate - but in the meantime:
Good Luck.
You can convert the timestamp to date only with INT(), giving you the following formula:
=INT(A1)-INT(B1)
I'm working on a project where I have to parse excel files for a client to extract data. An odd thing is popping up here: when I parse a date in the format of 5/9 (may 9th) in the excel sheet, I get 39577 in my program. I'm not sure if the year is encoded here (it is 2008 for these sheets).
Are these dates the number of days since some sort of epoch?
Does anyone know how to convert these numbers to something meaningful? I'm not looking for a solution that would convert these properly at time of parsing from the excel file (we already have thousands of extracted files that required a human to select relevant information - re-doing the extraction is not an option).
Excel stores dates as the number of days since 0-JAN-1900 (so 1-JAN-1900 would have a value of "1"). You can find a really good breakdown of how Excel handles dates and times here:
Dates And Times In Excel
When dates appear on screen in Excel as "5/9", "May 9th", or some such, it is a trick of the formatting and is not representative of the underlying data value. It sounds like your parsing program is pulling the underlying value, not the formatted date. In order to suggest a fix, though, I need to know what your parsing program is (Excel macro, formula, outside code, etc.).
DateTime.FromOADate (if you're using .NET) is the method you want. Excel dates are stored as doubles. If you have dates in the first two months of 1900 you might get bit by the Excel 1900 leap year bug.
From http://msdn.microsoft.com/en-us/library/system.datetime.fromoadate.aspx:
Double-precision floating-point number
that represents a date as the number
of days before or after the base date,
midnight, 30 December 1899. The sign
and integral part of d encode the date
as a positive or negative day
displacement from 30 December 1899,
and the absolute value of the
fractional part of d encodes the time
of day as a fraction of a day
displacement from midnight. d must be
a value between negative 657435.0
through positive 2958466.0.
All you need to do is format the cells correctly. Or am I misunderstanding your question -- are you saying you want to do it OUTSIDE of Excel? I wasn't sure. I'll delete this answer if it turns out to be stupid.