By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,743 Members | 1,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,743 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.