469,271 Members | 1,743 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

timestamp in .net

Tom
Hi guys

How do I generate a timestamp in .net ?

I can't seem to find anything on it. I would've thought it would be in
DateTime but it isn't.

thanks
Tom
Jul 21 '05 #1
3 15368
Tom,

If you mean you want the current time try the static System.DateTime.Now
property:
DateTime now = System.DateTime.Now;
MessageBox.Show(now.ToString());

Otherwise, please explain a bit further what you want do to.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Tom" <to********@optushome.com.au> wrote in message
news:42***********************@news.optusnet.com.a u...
Hi guys

How do I generate a timestamp in .net ?

I can't seem to find anything on it. I would've thought it would be in
DateTime but it isn't.

thanks
Tom

Jul 21 '05 #2
For a string that is chronologically sortable, try this:
System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ff")

"Tom" wrote:
Hi guys

How do I generate a timestamp in .net ?

I can't seem to find anything on it. I would've thought it would be in
DateTime but it isn't.

thanks
Tom

Jul 21 '05 #3
Tom
no time stamp as in
<messageTimestamp>20041803161306527000+660</messageTimestamp>


"Dennis Myrén" <de****@oslokb.no> wrote in message
news:e%****************@TK2MSFTNGP09.phx.gbl...
Tom,

If you mean you want the current time try the static System.DateTime.Now
property:
DateTime now = System.DateTime.Now;
MessageBox.Show(now.ToString());

Otherwise, please explain a bit further what you want do to.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Tom" <to********@optushome.com.au> wrote in message
news:42***********************@news.optusnet.com.a u...
Hi guys

How do I generate a timestamp in .net ?

I can't seem to find anything on it. I would've thought it would be in
DateTime but it isn't.

thanks
Tom




Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by rong.guo | last post: by
5 posts views Thread by Prabu Subroto | last post: by
7 posts views Thread by JJ | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.