?
Solved

Changing the hour display

Posted on 2007-03-21
2
Medium Priority
?
162 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

762 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