Convert Current Date and time to serial

zezo2021

Member
Local time
Today, 08:54
Joined
Mar 25, 2021
Messages
412
I have an idea to general unique number

I want to convert the current date and time to serial


How can I do that

is a good idea to generate a unique number


please provide the code thanks for the help
 
Hi. Sorry for my confusion, but what do you mean by "serial?"
 
use CDbl([dateField or dateVariable])
 
Or use a GUID data type?

Forget that it's Excel.
 
I have an idea to general unique number

I want to convert the current date and time to serial


How can I do that

is a good idea to generate a unique number


please provide the code thanks for the help

Unfortunately, this is not a good idea. The problem is made worse by the fact that most of the Office date/time conversion routines are NOT guaranteed to yield unique numbers based on the NOW() function as a way to get a timestamp.

I know from other posts that you are trying to use an Excel-based app as a database with hidden tables. The biggest "gotcha" in this "use date/time" idea is that if you have tables sitting in the background and have multiple users pounding away on their keyboards in the foreground with their own copies of your front-end app, it is NOT out of the bounds of probability that two people could hit the ENTER key (or whatever you are using) at the same exact time. This would then translate to the same exact number as the output of the conversion. Office does not normally work in fractions of a second even though a Date variable could in theory hold milliseconds for dates. Further, you have limited resolution for the fastest "easy" timer that DOES hold fractional seconds. Even trying to use the Timer() function, that only is good to 1/60th of a second, so all you would be doing is "playing the odds" on the number you get.

It is up to you, of course, but if you are asking if this will work, I would have to say "Unlikely."
 

Users who are viewing this thread

Back
Top Bottom