Convert Current Date and time to serial (1 Viewer)

zezo2021

Member
Local time
Today, 16:56
Joined
Mar 25, 2021
Messages
381
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
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:56
Joined
Oct 29, 2018
Messages
21,467
Hi. Sorry for my confusion, but what do you mean by "serial?"
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:56
Joined
May 7, 2009
Messages
19,230
use CDbl([dateField or dateVariable])
 

Minty

AWF VIP
Local time
Today, 15:56
Joined
Jul 26, 2013
Messages
10,371
Or use a GUID data type?

Forget that it's Excel.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:56
Joined
Feb 28, 2001
Messages
27,162
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

Top Bottom