469,326 Members | 1,608 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,326 developers. It's quick & easy.

How to subtract time in '00:00:00' format?

I have a small application which is running every x minutes and I need
to display remaining time on the screen in this format (example):

"Next start will be in: 00:13:25"

, and it should automatically be subtracting second, and minutes, till
it all comes to zero and then my app will start.

I have this code I found somewhere on the internet:
Dim MyDate1 As DateTime = DateTime.Now
Dim MyDate2 As DateTime = MyDate1.AddHours(3000)
Dim difference as TimeSpan
code]

. but I am not getting the rest.
I would of course use some timer and so... but could someone help me
to get time changes displayed in so much needed '00:00:00' format?

thanks a lot

Martin
--------========--------
via www.dotnetboards.com

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 20 '05 #1
2 6365
Snip ---8<---
I have a small application which is running every x minutes and I need
to display remaining time on the screen in this format (example):

"Next start will be in: 00:13:25"

---8<--- Snip
Try String.Format("{0:HH:mm:ss}", Now). Here's a real simple console example

Module Module1
Dim WithEvents oTimer As Timers.Timer

Sub Main()
oTimer = New Timers.Timer(1000)
oTimer.Start()
Console.ReadLine()
oTimer.Stop()
End Sub

Private Sub oTimer_Elapsed(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs) Handles oTimer.Elapsed
Console.WriteLine(String.Format("{0:HH:mm:ss}", Now))
End Sub
End Module

HTH

Mark
Nov 20 '05 #2
thanks a lot
martin

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Travis Pupkin | last post: by
9 posts views Thread by MGRIDEOUT | last post: by
3 posts views Thread by joe ruggeri | last post: by
1 post views Thread by Scott Dunham | last post: by
10 posts views Thread by nussu | last post: by
18 posts views Thread by Dirk Hagemann | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.