Problem about get time

  • Thread starter Thread starter Ray
  • Start date Start date
R

Ray

Dear all,
I have some problems about getting the time. For example, it is 18:30
now. How can I get the string "1830"?
I have tried as follow:
String.Concat((Date.Now.ToString("t")).Substring(0, 2),
(Date.Now.ToString("t")).Substring(2, 2))
However, the result is "6:30"
Please help.
Thanks a lot,
Ray
 
Ray said:
I have some problems about getting the time. For example, it is 18:30
now. How can I get the string "1830"?

\\\
MsgBox(DateTime.Now.ToString("hhmm"))
///
 
"Ray" <[email protected]>'s wild thoughts were released
Dear all,
I have some problems about getting the time. For example, it is 18:30
now. How can I get the string "1830"?
I have tried as follow:
String.Concat((Date.Now.ToString("t")).Substring(0, 2),
(Date.Now.ToString("t")).Substring(2, 2))
However, the result is "6:30"

Is the date going to be 5 chars long (18:30), or 4 chars
long (6:30)?

Because that will certainly effect the result of
..Substring(2, 2)









Jan Hyde (VB MVP)
 
Dear Herfried,
Thanks for your reply. I have tried your code. However, the result is
"0630". If I want to get "1830", how can I get that?
Thanks,
Ray
 

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

Back
Top