[Webinar] Streamline your web hosting managementRegister Today


TIME$ in  seconds-after-"01/01/1970" format

Posted on 1999-12-09
Medium Priority
Last Modified: 2012-05-04
is there a standard function to convert time$ into the 'seconds-after-1970'-format? this would be a lot easier and quicker for my database application which has to search on date/time very, very often

i know in unix this format is standard, but i haven;t seen it in vb yet.

It isn;t hard to program, but it seems kinda slow .. besides, i don;t know all the exceptions (which year had one day to many etc)
Question by:heit
LVL 12

Expert Comment

ID: 2268588
Internally date/time is a double. Date is integer part, time is decimal. This makes date comparisions about as fast as you're going to get them.

LVL 18

Accepted Solution

deighton earned 200 total points
ID: 2268589
DateDiff("s", DateSerial(1970, 1, 1), Now)
LVL 26

Expert Comment

ID: 2268610

(Now - 25569#) * 86400
LVL 12

Expert Comment

ID: 2268680
Right, but since time is already a *number* internally scaling up or down won't make the comparision operations any faster.

A Date is only a date when *displayed*. The internal comparisions are already in numeric. heit's idea for speeding things up will actually be SLOWER as the database is already doing what he wants internally.

If date/time were internally stored as character string he'd have a point. But since is *already* a number scaling won't run any faster and time lost in performing scale is wasted...


Author Comment

ID: 2268737
deighton, thanx!

mark2150> ok, i didn't tell te whole story .... i have to make a lot of queries which load all data not older than 30 minutes .. i think doing it in integers is easier, also because now it is a lot easier for me to know which is 30-minutes-ago exactly. I see your point however ... thanx anyway!

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question