Howdy I have a timespan that contain in excess of 24 hours. For the example lets use a value of 1 day 6 hours and 32 minutes. I would like to get this into a string that displays "30:32". Have so far tried something along the lines of `string.Format("{0}:{1}", TimeSpan.TotalHours, TimeSpan.Minutes)` however this gives me a scenario where it'll display 13:0 rather than 13:00 which I also failed to resolve.

Member Avatar
Member Avatar
+0 forum 2

This is just for fun. You know how old you are(I hope), but do you know how many days you are walking around on this planet? The two routines presented here could be used more practically in an ever present employee application.

Member Avatar
Member Avatar
+0 forum 4

I'm currently working on a collection of sub-projects, one of which was a backup manager. I needed to be able to allow the user to specify a backup time and a repeat interval. After thinking about the solution, decided it would be best for the user to provide an Initial DateTime of the first occurance and how frequent they would like to repeat the event. This class can be used to help determaine Alarms, Reminders or anything that requires an event to be triggered at a certain time. >Fun and Good for Beginners It was good fun writing this wee …

Member Avatar
Member Avatar
+1 forum 2

if (ts1.CompareTo(DateTime.Now) == -1 && ts2.CompareTo(DateTime.Now) == -1) { MessageBox.Show("...."); } the function asks for a object, i gave an object...

Member Avatar
Member Avatar
+0 forum 2

I've been given two dates that takes their values from two respective dtpickers. I've got to calculate the exact amount of days, months and years between them. So I tried this: Dim dteStartDate As Date Dim dteEndDate As Date dteStartDate = dtpStart.Text dteEndDate = dtpEnd.Text dteResultDays = DateDiff(DateInterval.Day, dteStartDate, dteEndDate) dteResultMonths = DateDiff(DateInterval.Month, dteStartDate, dteEndDate) dteResultYears = DateDiff(DateInterval.Year, dteStartDate, dteEndDate) The problem is that this method gives me ALL of the amount of respective days, months and years passed, but I need to split them in the correct way. Ex, between 28/2/98 and 13/1/2007 the result should be 15 days, …

Member Avatar
Member Avatar
+0 forum 6

Hi is there an accepted way to calculate the number of times a specific day would come round in a given timespan? For example if we have 32 as a variable that represents the number of weeks I would then need to find out how many times the first of the month would come round within those 32 weeks. thanks in advance

Member Avatar
Member Avatar
+0 forum 2

Hello all, I'm really struggling to find a way or method to convert my TimeSpan data type into an Int so I can put the value into an Array. Now I know you can't actually convert the TimeSpan variable into Int, but is there some sort of work around? This is what I have so far: [code] DateTime startTime = DateTime.Now; op1r: Console.WriteLine("What is the Answer?"); Console.WriteLine(); Console.WriteLine("1 - Add"); Console.WriteLine("2 - Subtract"); Console.WriteLine("3 - Multiply"); Console.WriteLine("4 - Divide"); input = Console.ReadLine(); intInput = int.Parse(input); if (intInput == 1) { DateTime stopTime = DateTime.Now; TimeSpan duration = stopTime - startTime; …

Member Avatar
Member Avatar
+0 forum 4

Basically what I want is to have the timer be reset back to 3 sec once the [COLOR="red"][B]Reset button[/B][/COLOR] is clicked. Preferably, I want the code to be in the same sub as the timer, though any better ideas are most welcomed. I've already put in comments where i want the code to be... thanks in advance for your help :) Here's the part of the code... [CODE=syntax]Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick Static CountDown As New TimeSpan(0, 1, 0) Dim Time0 As New TimeSpan(0, 0, 0) CountDown = CountDown.Subtract(New TimeSpan(0, 0, 1)) If …

Member Avatar
Member Avatar
+0 forum 4

The End.