[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Changing the hour display

Posted on 2007-03-21
2
Medium Priority
?
163 Views
Last Modified: 2010-04-23
Hi there,
How can i format the time in VS 2005?
right now i have the time display as 4:35 pm but i need instead to show 16::35pm
Thanks
0
Comment
Question by:jsctechy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 14

Accepted Solution

by:
jake072 earned 2000 total points
ID: 18767187
Use:

DateTime.ToString("t")

That will result in 16:35.

It will not include pm, as that information is redundant...  If you need to include pm, then

DateTime.ToString("t") & CStr(IIf(DateTime.Now > 12, "pm", "am"))

You can also use DateTime.ToString("T") to display the seconds as well.

Jake
0
 
LVL 14

Expert Comment

by:jake072
ID: 18767190
NOTE: DateTime is a DateTime variable :)

If you want the current time, repleace DateTime with DateTime.Now.

Jake
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question