how to convert a decimal number in excel to date and time

With a have excel column with number like 1417528069
                                                                               1417544959
These number are actually represent date and time in an sybase table column.
how can these numbers be converted to date and time.
ShenAsked:
Who is Participating?
 
barry houdiniCommented:
Actually, looking again, those look like Unix timestamps, i.e. the number of seconds since 1/1/1970. If that's the case then with the timestamp in A2 use this formula to convert in B2

=DATE(1970,1,1)+A2/86400

Format B2 to show date and time, e.g. with custom format d-mmm-yyyy hh:mm:ss or similar

1417528069 converts to 2-Dec-2014 13:47:49

regards, barry
0
 
Hakan YılmazTechnical Office MEP EngineerCommented:
Normally, dates in excel are decimals, but they are smaller numbers.
The decimal Zero is 0.01.1900 with default settings.
Counting days from this date, 02.03.2015 is represented by 42065.
And 42065,875 means, 02.03.2015 + 0,875 day = 02.03.2015 21:00.
0
 
barry houdiniCommented:
Hello Rickgov,

Do you know which date/time values those convert to?

What do you want 1417528069 to convert to? What about 1417544959?

I don't know how to convert those......but if you can give some sample conversions it should be possible to use an excel formula to replicate that

regards, barry
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Danny ChildIT ManagerCommented:
I don't see how  the numbers above represent dates, I would have anticipated something along the lines of
yyyymmddThhmm as a possible sybase format.

Can you explain further please, preferably giving some examples?

then, we can get Excel to do the translation for you, on an ongoing basis...

Generally, using Excel's LEFT, MID and RIGHT functions lets you pull out certain characters from a string of a pre-defined format (for example characters 5 and 6 could give a 2-digit month code).

You can then use these with the CONCATENATE or & functions to build date strings

eg
Cell A1 = 20150228 - which would mean the 28th Feb '15
Cell B1 = =RIGHT(A1,2)&"/"&MID(A1,5,2)&"/"&LEFT(A1,4)
and this cell would then return 28/02/2015 - which is a valid excel date format
0
 
Tony PittCommented:
I believe Sybase stores dates based on 1753.  Therefore these numbers will be something like number of days since 1 Jan 1753, but we need to know what certain integers represent to be able to work out exactly what.

/T
0
 
Tony PittCommented:
Sybase supports the DATETIME and SMALLDATETIME values. A DATETIME can have a value from Jan 1 1753 to Dec 31, 9999 with a 300th of a second resolution. A SMALLDATETIME has a range of Jan 1 1900 to Jun 6 2079 with a 1 minute resolution... at least according to something that I found on the Internet.

However, these are still rather odd values, I think.

/T
0
 
ShenAuthor Commented:
I tried the formula=DATE(1970,1,1)+A2/86400 and the format d-mmm-yyyy hh:mm:ss and is close.

We have a record with 1425320708 that should output: 2-Mar-2015 1:25:08 PM. However, when i run the formula and the format it outputs: 2-Mar-2015 06:25:08  PM.  It has the gmt  5 hours difference. Is there any away to adjust the formula to display local time
0
 
ShenAuthor Commented:
it iseens to be okay now. i subtract form the formula time(5,0,0).
0
 
ShenAuthor Commented:
thanks for the help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.