using current date and time format as serial number tia sal22

  • Thread starter ratullloch_delthis
  • 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
 
A

Arne Vajhøj

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top