Unix Timestamp to CET excel formula - excel

I am trying to convert a Unix Timestamp to CET
I used the formula I found in this site, asked by another user
=(A1/86400)+DATE(1970;1;1) - since I live in German',' were replaced in formula to ';'
but it does not work for me, the result I get is #############################
for example timestamp 1629294665262271969 should give Wed Aug 18 2021 14:51:05
but I get 'dates and time that are negative or too large are shown as ######################'
I thought that it might be because it could be in milliseconds so I divided by another 1000 but the result is the same
any advice will be welcomed,
Much appreciated,

It's not in miliseconds all in seconds. Excel dating system starts from 01.01.1900 but Epoch timing starts from 01.01.1970 so we need to convert two dates to same value that's the reason why we add or remove =DATE(1970;1;1)
When you look at a date in excel by using =VALUE(A1) formula you will see some number. These numbers shows you how many days past from 01.01.1900 to given date. So you multiply the value with 86400 to convert day values to seconds. That is the idea how it works.
I wrote the formula you need but you also need to clear current format of cells if you see something like ########### it's probably there was a date formatted value before you write the formula.
Formula examples below.
Date to Epoch time
A1 is 19.08.2021. Formula on B1 is =VALUE(A1-DATE(1970;1;1))*86400. Result: 1629331200
Epoch to Date time
A1 is 1629331200. Formula on B1 is =(A1/86400)+DATE(1970;1;1). Result: 19.08.2021

Related

Convert Modified Julian Date to UTC Date in Excel

I am looking for a formula where I can put a 5 digit Modified Julian Date and have it convert it to today's date for me.
I did it in a way where I have a separate sheet with a table but although it works, I am looking for a way without the need of a separate table. Here is some information:
00000 should translate to 11-17-1858
58890 should translate to 02-11-2020
Every time the number goes up 1, it should go up 1 day. This needs to have leap years in consideration as well. Any help will be appreciated.
Here is a website that currently does the conversions:
http://www.csgnetwork.com/julianmodifdateconv.html
This has to be done without macros, literally need it in formula format.
Just subtract 15018 and format the result as a date.
Why 15018 and not 15020?
In Excel, 1-Jan-1900 value is 1
In your date scheme 15020 = 1-Jan-1900
But, if you had the number 15020 to convert and subtracted 15020 it would --> 0, not the desired 1.
Therefore we reduce the 15020 by 1 to 15019.
Next, there is a deliberate "bug" in Excel, widely discussed both on SO and the internet, whereby the year 1900 is erroneously classified as a leap year.
So for any date equivalent that is after 28-Feb-1900, we have to subtract an extra 1.
If you might be dealing with dates between 1/1/1900 and 2/28/1900 you will need to modify the formula to take that into account.

Excel - Convert JavaScript/Unix timestamp to date

I'm wondering how to convert a timestamp to a date in Excel.
JavaScript timestamp:
1486812409161
Unix timestamp
1486812409
What Excel function / formula can convert to something like:
2/11/2017 11:26 AM (or any human readable date)
I did see this answer, but I can't get this to work for me (on Mac OS X / Excel 2011).
When I create a new cell and set it's value to the following formula:
= (MsValueCellReference / 86400000) + DATE(1970,1,1)
The result is: 41315.47696
I am using the current formula =(<javascriptTimestamp>)/(1000*60*60*24)+25569 and then formatting the cell with dd/mm/yyyy hh:mm:ss.
To explain the terms in the formula, the Javascript timestamp has milliseconds which accounts for the 1000. There are 60*60*24 seconds in one day.
Finally, Excel dates start on Jan 1 1900, and Javascript starts on Jan 1 1970. There are 25569 days between Jan 1 1900 and Jan 1 1970.
Excel is pretty happy to interconvert between dates and numbers, as you noticed. However, afaict, it can't always guess correctly which of the two you want to see.
So, to ensure that a value is rendered as a date, you'd need to open the Format Cells dialog, go to the first tab Number, and set the cell's format Category to one of the Date types.

Text to Columns formatting issues with Date/Time

I am trying to figure out if this is an Excel bug or just a formatting issue. So I have a column with a date and time in the format m/d/yyy h:m AM/PM (ie. 10/21/2015 2:21:00 PM), and am trying to split it into two individual columns: one with the date and one with the time. I tried using fixed width first, but ended up using delimited just so I could split it exactly where I wanted.
For some reason when it splits the two up, the actual value for time changes. I will end up with one column with the date and a time of 12am (10/21/2015 12:00 AM) and one column with the initial time minus 12 hours (2:21:00 AM).... Trying to figure out why there is still a time value in the date column and why the time value changes. Ideally I want to have a column with 10/21/2015 and another with 2:21:00 PM.
I've tried changing the format of the initial date/time combination etc. and it keeps on subtracting 12 hours from the initial time when it splits.
Has anybody experienced or heard of similar issues?
I think your question is confusing, for example I tried using fixed width first, but ended up using delimited just so I could split it exactly where I wanted. seems back-to-front, but you have a datetime value for October 21, 2015 14:21 hrs, want that as a date in one column and 02:21:00 PM in the next and your environment is UK style (ie day before month).
IF so Text to Columns may be as confusing as helpful. Format the date column as date (to suit) and the time column as hh:mm:ss AM/PM (or similar) and the following formulae may suit, assuming your datetime value is in A1:
For date: =INT(A1)
For time: =MOD(A1,1)

Convert long date text to date / time

I have an Excel (2010) spreadsheet delivered to me which is basically a text dump.
Cell - J8 has the following info Tue Feb 4 00:08:06 EST 2014
Cell - L8 has the following info Tue Feb 4 00:14:54 EST 2014
I need to calculate the difference in time between L8 and J8.
These cells are formatted as "text" and since they have the day, date, time and "EST" formatting the cells with long date it doesn't work.
I did this to parse the date/time value of each cell:
=DATE(RIGHT(J8,4),VLOOKUP(MID(J8,5,3),$P$2:$Q$13,2,FALSE),MID(J8,9,LEN(J8)-26))
+TIME(MID(J8,11+LEN(J8)-27,2),MID(J8,14+LEN(J8)-27,2),MID(J8,17+LEN(J8)-27,2))
Then you can just do a simple subtraction between the values of the two cells.
The only thing I needed to add to the spreadsheet was a lookup table to map month name to month value. Hence the VLOOKUP in the formula.
I also needed to calculate the offset position past the day value as it appears that it could have either one or two digits - hence the magic 26 and 27 numbers in the formula.
Uses an array (column of months MMM, and 1-12) and can surely be improved, but to tide you over:
=DATE(RIGHT(J8,4),VLOOKUP(MID(J8,5,3),array,2,0),MID(J8,9,2))+VALUE(MID(J8,11,9))
in say Y8 and copied across to Z8 with =Z8-Y8 in AA8 may suit (for the 'time' being!)
Does not cater for differences in time zones.
If L8 is always later than J8, and if the format is always as you show (with three letters for the timezone, and the spacing as above, then try:
=(MID(L8,5,6)&", "&RIGHT(L8,4) &" "& MID(L8,11,9))-(MID(J8,5,6)&", "&RIGHT(J8,4) &" "& MID(J8,11,9))
One further caveat with this method: your native default date (in Windows Control Panel, not in Excel itself) needs to be MDY as in your text dump.
EDIT: The following (longer) version should work no matter if your native date format is MDY or DMY:
=(MID(L8,9,2)& MID(L8,4,4)&RIGHT(L8,5)&" "&MID(L8,11,9))-(MID(J8,9,2)& MID(J8,4,4)&RIGHT(J8,5)&" "&MID(J8,11,9))

Excel - calculate date time

I am trying to calculate the hour difference between two times. What I've been doing now only gives me hour indications like 1:30, 2:45, etc but I can't make diagrams based on these values. If I get 2:30 as the hour difference, it should become 2,5. if the difference is 2:45 that should be 2,75.
Change your formula to:
(B2-A1)*24
and format as General
You should just be able to subtract 1 datetime from the other. Try this:
In cell A1, enter "09/17/2012 10:00" (Excel should automatically recognize this as a date)
In cell A2, enter "09/17/2012 11:30"
In cell A3, "=(A2-A1)*24". The result is 1.5.
The problem may be that you are trying to subtract 1 'time' from another 'time' without a date component. In that case, Excel may not recognize your value as a 'time'. Try adding a dummy date to the beginning of the time.
One limitation of this is that you will get an error response of "########" if the 2nd date is earlier than the 1st (because the result is negative). If this is an issue, try "=ABS(A2-A1)*24" instead.

Resources