Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

toolStripStatusLabel3.Text = (DateTime.Now.ToString());

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CMartin - 31 Oct 2007 17:50 GMT
How do I get the value of DateTime to show two characters when it is inthe AM?

What I get in PM = 10/31/07 12:34:22 PM
What I get in AM = 10/31/07 2:34:22 AM

I need:  10/31/07 02:34:22 AM
To make my comparisons easier.

Or better yet, I want to start someting after a certain date.time and end
when another date/time is met. Any ideas how to do this wihtout complicated
string comparisons?
Nicholas Paldino [.NET/C# MVP] - 31 Oct 2007 17:58 GMT
CMartin,

   Why not take the string and convert to a DateTime instance using the
Parse (or TryParse, if you are unsure of the format) method?  You would have
a much easier time comparing the DateTime instances then.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> How do I get the value of DateTime to show two characters when it is inthe
> AM?
[quoted text clipped - 9 lines]
> complicated
> string comparisons?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.