Solved

Changing the hour display

Posted on 2007-03-21
2
160 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 500 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with adding DLL file in Windows project 20 47
Complex SQL statement in VB.NET 7 39
Optimize the query 5 53
Add Combobox column to datagridview using vb.net 2 27
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

733 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