timespan Questions

4

Solved

PowerShell Timespans are great for quickly displaying durations, as in: $starttime = $(get-date) { do some processing here } write-host "Duration: $((new-timespan $starttime $(get-date)).tostring(...
Wolfhound asked 20/8, 2010 at 23:55

13

Solved

I would like to format some commands execution times in a human readable format, for example: 3 -> 3ms 1100 -> 1s 100ms 62000 -> 1m 2s etc .. Taking into account days, hours, minutes, s...
Homophony asked 3/4, 2012 at 13:4

6

Solved

I need to convert this into a timespan: 8 8.3 8.15 When I do it like so: DateTime s = booking.TourStartDate.Add(TimeSpan.Parse(booking.TourStartTime.Replace(".", ":"))); It will end up addin...
Publican asked 16/7, 2013 at 16:30

9

Solved

I have a code generating a timespan to calculate a duration of some action. What I want to do is to take that result (the duration) and divide it by a number, any number. How can I do that?
Volar asked 3/4, 2012 at 13:10

8

Solved

I'm trying to put together a tool that will help me make work schedules. What is the easiest way to solve the following? 8:00am + 5 hours = 1:00pm 5:00pm - 2 hours = 3:00pm 5:30pm - :45 = 4:45 an...
Chanteuse asked 22/10, 2010 at 1:20

3

I'm building a web app using Angular + Typescript. And I have ASP.NET Web API. One of the endpoints returns model with timespan property. I used string type just to show it but now I need to draw o...
Mystique asked 11/3, 2018 at 5:29

10

Solved

Both of these generate an error saying they must be a compile-time constant: void Foo(TimeSpan span = TimeSpan.FromSeconds(2.0)) void Foo(TimeSpan span = new TimeSpan(2000)) First of all, can so...
Epigrammatist asked 30/1, 2010 at 17:50

4

Solved

I get from TimeSpan.TotalHours 24,75 hours. How can I convert this to get the full and not roundes hours (=24) plus the minutes (0,75hours = 45 minutes)? So the result should be hours = 24 and min...
Os asked 23/3, 2016 at 12:39

4

Solved

TimeSpan Earlybeforetime = new TimeSpan(); Earlybeforetime = earlybefore.Subtract(Convert.ToDateTime(outtime); Sometimes it returns a negative value. How do I convert the value to be always posit...
Combustor asked 19/1, 2012 at 8:40

3

Solved

I realise that JSON has no real date format and that using ISO 8601 is a good bet given that's what JavaScript uses. What about a duration? JavaScript has no built in format. I came across ISO 86...
Sausage asked 22/5, 2018 at 15:47

1

Solved

Is there a built-in function in smalltalk that takes as input two timespans, and checks whether they intersect? As an example: the two timespans 2018/01/01-2018/01/05 and 2018/01/03-2018/01/10 do i...
Atiptoe asked 17/6, 2023 at 23:17

6

Solved

I was writing a converter that takes a person's date of birth and produces their age in years. I wrote something that looked like this: public class DateOfBirthToAgeConverter : IValueConverter { ...
Dominik asked 5/5, 2015 at 17:15

13

Solved

I am trying to serialize a .NET TimeSpan object to XML and it is not working. A quick google has suggested that while TimeSpan is serializable, the XmlCustomFormatter does not provide methods to co...
Rotter asked 12/3, 2009 at 9:55

13

Solved

I have a TimeSpan representing the amount of time a client has been connected to my server. I want to display that TimeSpan to the user. But I don't want to be overly verbose to displaying that inf...
Westward asked 22/5, 2013 at 10:30

7

Solved

I need to display simplest version of elapsed time span. Is there any ready thing to do that? Samples: HH:mm:ss 10:43:27 > 10h43m27s 00:04:12 > 4m12s 00:00:07 > 7s I think I need a fo...
Reexamine asked 22/3, 2011 at 21:47

7

Solved

How can I find the time in milliseconds using PowerShell?
Radtke asked 30/1, 2012 at 6:42

2

Solved

I'm trying to create a task which will repeat every 5 minutes indefinitely through powershell. However, I cannot figure out a way to do this through all my searching. New-TimeSpan -Days 9999 appear...
Dhahran asked 29/4, 2015 at 20:28

4

Solved

There has to be an easy answer: var totalTime = TimeSpan.Zero; foreach (var timesheet in timeSheets) { //assume "time" is a correct, positive TimeSpan var time = timesheet.EndTime - timesheet.S...
Crap asked 27/8, 2010 at 2:33

8

Solved

I am converting minutes into hours. So if I have minutes = 12534. The result should be 208:54. The below code fails to bring this result. TimeSpan spWorkMin = TimeSpan.FromMinutes(12534); string w...
Resnatron asked 8/10, 2015 at 6:10

12

Solved

Using .NET 3.5 I want to determine if the current time falls in a time range. So far I have the currentime: DateTime currentTime = new DateTime(); currentTime.TimeOfDay; I'm blanking out on ho...
Rozanneroze asked 1/10, 2009 at 15:2

6

Solved

I have two textboxes. One for a clock in time and one for clock out. The times will be put in this format: Hours:Minutes Lets say I have clocked in at 7:00 AM and clocked out at 2:00 PM. With m...
Payday asked 20/9, 2012 at 21:42

32

Solved

I have timespans: String time1 = 01:00:00 String time2 = 05:00:00 I want to check if time1 and time2 both lies between 20:11:13 and 14:49:00. Actually, 01:00:00 is greater than 20:11:13 and less ...
Lamed asked 17/7, 2013 at 10:55

1

Solved

TimeOnly was one of the new types introduced with .Net 6 along with DateOnly. I understand the great need for the DateOnly type as there are many instances you would want to store a date without a ...
Delwin asked 30/6, 2022 at 13:26

8

Solved

Basic problem I have a bunch of records and I need to get latest (most recent) and the oldest (least recent). When googling I found this topic where I saw a couple of queries: // option 1 Tweet....
Zondra asked 17/9, 2012 at 21:5

5

Solved

I'm trying to seed some constants into my DB: context.Stages.AddOrUpdate(s => s.Name, new Stage() { Name = "Seven", Span = new TimeSpan(2, 0, 0), StageId = 7 }); context.Stages.AddOrUpda...
Photocell asked 16/6, 2013 at 3:3

© 2022 - 2024 — McMap. All rights reserved.