|
-
Oct 30th, 2002, 04:34 PM
#1
Thread Starter
Fanatic Member
Date and Time
I need to be able to generate a number that is a 14 digit number in this format:
My number is the number of 10,000 of a second from January 1st, 1900 and then append 2 random numbers to the end.
Can someone help? I've never done anything like this. Thanks, Jeremy
He who listens well, speaks well.
-
Oct 30th, 2002, 05:44 PM
#2
PowerPoster
look up datediff --- that'll get you started.
-
Oct 30th, 2002, 10:19 PM
#3
Fanatic Member
VB Code:
Option Explicit
Private Sub Form_Load()
'You only want to randomize once in your project
' or your random #'s won't be random!
Randomize
End Sub
Private Sub Command1_Click()
Dim lngNumSeconds As Long
Dim dblTTSeconds As Double
Dim intRandom As Integer
Dim strMyNumber As String
'get seconds for 01/01/1990 till now
lngNumSeconds = DateDiff("s", "01/01/1990", Now)
'convert that to 10,000 of seconds elapsed
dblTTSeconds = CDbl(lngNumSeconds) * 10000
'now build this number (string)
'we are going to add two digits so show at least
' 12 digits, but only 12 digits!
strMyNumber = Format(Left(dblTTSeconds, 12), "000000000000") & Format(Int((Rnd(1) * 99) + 1), "00")
MsgBox strMyNumber
End Sub
something like that?
"Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!
Resistance is futile, you will be compiled . . . Please!
-
Oct 31st, 2002, 04:41 PM
#4
Thread Starter
Fanatic Member
That works for me
Thanks once again for your help. Later, Jeremy
He who listens well, speaks well.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|