I want to field calculate a field to be have a have the date and time (down to the second) and two letters after (to be assigned by user).
For example, if the record was created on September 8th, 2016 at 7:15 am and 03 seconds it would look like this: 090816071503XX
I also need this to be unique though, in some cases this field calculate will be performed on over 5000 records. By doing a complete field calculate in real-time, this means all 5000 records would show the same time. So I need a code that will field calculate a "fake", but realistic time (i.e. can't have hour 25). I don't care that this time is incorrect, but I do want the date to be correct.
I imagine this is something that can be scripted in Python?
I have a VBA (.cal) script I can load into the field calculator which will calculate the date and time, but as I said, I need it to return unique times.
'enter your initials
INIT="XX"
'month string - add zero
If LEN(DatePart ("m", Now ( ) ))=1 then
MO = "0"&DatePart ("m", Now ( ) )
Else
MO = DatePart ("m", Now ( ) )
end if
'day string - add zero
If LEN(DatePart ("d", Now ( ) ))=1 then
DA = "0"&DatePart ("d", Now ( ) )
Else
DA = DatePart ("d", Now ( ) )
end if
'year string - two digits
YR = RIght(DatePart ("YYYY", Now ( ) ),2)
'HR string - two digits
If LEN (DatePart ("h", Now ( ) ))=1 then
HR = "0"&DatePart ("h", Now ( ) )
Else
HR = DatePart ("h", Now ( ) )
End if
'MN string - two digits
If LEN (DatePart ("n", Now ( ) ))=1 then
MN = "0"&DatePart ("n", Now ( ) )
Else
MN = DatePart ("n", Now ( ) )
End if
'SS string - two digits
If LEN (DatePart ("s", Now ( ) ))=1 then
SS = "0"&DatePart ("s", Now ( ) )
Else
SS = DatePart ("s", Now ( ) )
End if