Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Getting Unixtime in VBA

Hi, I'm having some trouble getting the current unix time. I see a lo
of people here try to convert from unix time to human readable time
but I actually need the unix time.

How can I get it in VBA scripting

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Getting Unixtime in VBA

J.E. McGimpsey has some notes at:
http://www.mcgimpsey.com/excel/#usingvba

One of those notes is:
If A1 contains the UNIX time value, the XL date/time is:
=DATE(1970,1,1) + A1/86400

So I put that formula in B1. (and some giant number in A1)

So to convert that back:
=(B1-DATE(1970,1,1))*86400

And got my original value back!

J.E. has some code that does the first conversion in a UDF.

He made some nice enhancements that include if it was called from a worksheet
and what your basedate (1900 or 1904) is.

If you really need code (I wouldn't), then you could use his as the shell for
yours.


"Scalpel <" wrote:

Hi, I'm having some trouble getting the current unix time. I see a lot
of people here try to convert from unix time to human readable time,
but I actually need the unix time.

How can I get it in VBA scripting?

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"