using current date and time format as serial number tia sal22

  • Thread starter Thread starter ratullloch_delthis
  • Start date Start date
R

ratullloch_delthis

Greetings All

I would like to use the current date and time as a serial number in csharp what command or tutorial if there is one should I use?
example: of what I'm trying to produce.

12 03 2010 09 49 33.416
This would represent december 03 2010, 09:49:33.416 am Also how would I create the leading zero's

tia sal22
 
I would like to use the current date and time as a serial number in csharp what command or tutorial if there is one should I use?
example: of what I'm trying to produce.

12 03 2010 09 49 33.416
This would represent december 03 2010, 09:49:33.416 am Also how would I create the leading zero's

dt.ToString("dd MM yyyy HH mm ss.fff")

should do that, but:
1) I will suggest "yyyy MM dd HH mm ss.fff" to get a better ordering.
2) Maybe you should consider another way to generate serial
numbers, because on todays fast computers may be very realistic
to create two of something within the same millisecond (often
using database identity/auto increment is a simple way to
achieve true uniqueness)

Arne
 
Back
Top