UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> How Can I Convert This Number To A Date?, Not applicable    
 
   
lituan
post Nov 25 2018, 04:46 AM
Post#1



Posts: 4
Joined: 25-November 18



Hi, i've downloaded a receipt in excel and the date is displayed in numbers: 1524156973
What are these numbers?
Go to the top of the page
 
mark337
post Nov 25 2018, 04:51 AM
Post#2



Posts: 1
Joined: 25-November 18



Hi lituan, according to Unix Time Converter 1524156973 corresponds to 2018/04/19 5:56:13 pm.
Hope it helps.
Go to the top of the page
 
lituan
post Nov 25 2018, 06:59 AM
Post#3



Posts: 4
Joined: 25-November 18



Thank you Mark. It was really useful
This post has been edited by lituan: Nov 25 2018, 06:59 AM
Go to the top of the page
 
cheekybuddha
post Nov 25 2018, 07:50 AM
Post#4


UtterAccess VIP
Posts: 10,649
Joined: 6-December 03
From: Telegraph Hill


Hi,

If you need to convert in VBA you can use a function like:
CODE
Function UnixTimestampToDate(UnixTimestamp As Long) as Date

  Const EPOCH As Date = #1970-01-01#

  UnixTimestampToDate = DateAdd("s", UnixTimestamp, EPOCH)

End Function


Note: the Daylight Saving on your computer will affect the date returned.

For 1524156973, using the function I get 19/04/2018 16:56:13 (I'm in the UK)

With the website liked by mark337, I get 2018/04/19 17:56:13

hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
GroverParkGeorge
post Nov 25 2018, 10:13 AM
Post#5


UA Admin
Posts: 34,136
Joined: 20-June 02
From: Newcastle, WA


I am really curious as to how this happened in the first place. i.e. how you got a "receipt" into Excel with the value 1524156973 supposedly presented as a date. Excel would not be able to convert that, as nearly as I can tell from a quick test, into a valid date and time, so I'm wondering what the SOURCE was? What kind of receipt is it? What format was the receipt document?

Thanks.

You might benefit from learning about how Excel stores dates internally, as well.

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Visit My Blog on Facebook
Go to the top of the page
 
lituan
post Nov 25 2018, 04:17 PM
Post#6



Posts: 4
Joined: 25-November 18



Hi, Thanks for the reply. How does timestamp works with daylight saving? Isn't it supposed to be adjusted the same for all times?
Go to the top of the page
 
R. Hicks
post Nov 25 2018, 04:28 PM
Post#7


UA Forum Administrator
Posts: 40,495
Joined: 8-February 00
From: Birmingham, Alabama USA


A unix timestamp does not contain any time zone data. It is UTC and has no DST settings.
You would need to create a procedure to adjust to a specific time zone based on physical location and the DST offset based the specific date value when the offset occurs ...

R.

--------------------
Ricky Hicks
Birmingham, Alabama USA
Go to the top of the page
 
lituan
post Nov 25 2018, 04:29 PM
Post#8



Posts: 4
Joined: 25-November 18



Hi! Thanks for the reply. Apparently it has been generated by a third-party program that had some kind of bugs. It was from an hosting provider. I've sent a message and they fixed. Now it's showing the date and time correctly.
I will learn more about datetime soon smile.gif
Thanks for your help notworthy.gif
Go to the top of the page
 
R. Hicks
post Nov 25 2018, 04:33 PM
Post#9


UA Forum Administrator
Posts: 40,495
Joined: 8-February 00
From: Birmingham, Alabama USA


You are very welcome if my very late contribution helped in any way .. wink.gif

R.

--------------------
Ricky Hicks
Birmingham, Alabama USA
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    18th December 2018 - 05:45 AM