removing seconds from System.DateTime.Today.Now

G

Guest

i use the following code to display date and time of system
System.DateTime.Today.Now

but it displayes seconds also haw can i make it display date and time
without seconds

and haw can it display time only with no date and without seconds also

thank you
--
Ammar S. Mitoori
IT Head QIMCO Co.
Tel : +9744831199
Mobile : +9745378400
Fax : +9744831643
 
M

Mads Bondo Dydensborg

Pure said:
i use the following code to display date and time of system
System.DateTime.Today.Now

but it displayes seconds also haw can i make it display date and time
without seconds

and haw can it display time only with no date and without seconds also

I assume you are implicitly converting to a string. Check DateTime.ToString(
string )

http://msdn2.microsoft.com/en-us/library/zdtaw1bw.aspx

Regards,

Mads

--
Med venlig hilsen/Regards

Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo
Dydensborg
Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77
34
 
G

Guest

Pure said:
i use the following code to display date and time of system
System.DateTime.Today.Now

That would be System.DateTime.Now
but it displayes seconds also haw can i make it display date and time
without seconds

and haw can it display time only with no date and without seconds also

thank you

Specify a format when you convert the DateTime into a string. Example:

DateTime t = DateTime.Now;
String time = t.ToString("HH':'mm");
 

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