timespan Questions
2
Solved
I am compiling in C# using .NET 3.5 and am trying to convert a TimeSpan to a string and format the string. I would like to use
myString = myTimeSpan.ToString("c");
however the TimeSpan.ToString ...
Already asked 20/7, 2012 at 12:7
2
Solved
I am trying to use the ternary operator in this piece of code, where Model.FirstTechSupportAssigneeElapseTime is of type TimeSpan?:
<dt>Assigned In</dt>
<dd>
@if (@Model.FirstTe...
Satiated asked 6/2, 2015 at 0:0
2
Solved
MSDN says:
The styles parameter affects the interpretation of strings parsed using custom format strings. It determines whether input is interpreted as a negative time interval only if a negativ...
5
Solved
Consider this code (prestuffed with an example):
DateTime dt1 = DateTime.Parse("7/30/2010 9:33:29.1234567 AM");
DateTime dt2 = DateTime.Parse("6/30/2010 9:33:00.7654321 AM");
TimeSpan ts = dt1 - ...
Besse asked 30/7, 2010 at 15:38
5
Solved
I recently encountered some weird behaviour in the .NET TimeSpan implementation.
TimeSpan test = TimeSpan.FromMilliseconds(0.5);
double ms = test.TotalMilliseconds; // Returns 0
FromMilliseconds...
1
Solved
I've been going over some Microsoft samples of code for the Kinect sensor and have stumbled across the following line.
TimeSpan zeroDuration = TimeSpan.FromSeconds(0.0);
TimeSpan timeRemaining = ....
4
Solved
I am trying to calculate the difference between two dates. This is what I'm currently using:
int currentyear = DateTime.Now.Year;
DateTime now = DateTime.Now;
DateTime then = new DateTime(current...
2
Solved
I was looking at the metadata for System.Web.Configuration.CompilationSection, and noticed the following attribute on the TimeSpan BatchTimeout property:
[TimeSpanValidator(MinValueString = "00:00...
Joerg asked 28/5, 2010 at 23:15
7
Solved
I am building a form with winforms - and should add a view and editable time span value.
Which controls works best for this ?
A normal edit control shows the value correctly -> but it's not really...
1
Solved
You can specify a custom format for a DateTime object like this:
DateTime.Now.ToString("HH:mm:ss"); // 19:55:23
But when I try to use the same format for a TimeSpan object like this:
DateTime.N...
5
Solved
When a user fills out a form, they use a dropdown to denote what time they would like to schedule the test for. This drop down contains of all times of the day in 15 minute increments in the 12 hou...
5
I have a SQL Server table with two datetime fields (CnxStartdatetime, CnxEnddatetime). Each row represents a transmission of information. I am trying to find the maximum number of concurrent transm...
Zeal asked 29/4, 2011 at 5:31
5
Solved
I use this code for converting Timespan to String (for ex: 14:53) :
myTimeSpan.ToString("hh:mm");
but this error occurs:
Input string was not in a correct format
What is the proper way to d...
6
Solved
I have 1 single text box which a user will enter the number of hours. At present, if they enter 26 hours, we get an error because of the TimeSpan's HH limit. This value is going to get stored in a ...
4
Solved
I'm trying to convert the convert time to the user's time zone, but I don't have the windows time zone string such as "Pacific Standard Time". All I have is a string offset such as "-07:00". Looks ...
5
Solved
In C# there is a TimeSpan class. It represents a period of time and is returned from many date manipulation options. You can create one and add or subtract from a date etc.
In Ruby and specificall...
3
I have a list of
*startTime (datetime)
*endTime (datetime)
and need to work out the average time for everything in the list.
So I am guessing I need something like
long averageTime =
Conver...
4
Solved
Is there an elegant solution to walk through an ordered list to do some calculations on the current and the next object? There must be a smarter way with LINQ to do the following:
public static Li...
1
Solved
I have a MVC page containing a few timepickers. These are stored in a list of objects in the model as nullable TimeSpan. The problem is that I get the timespans printed with seconds into the input ...
Vashti asked 10/7, 2013 at 12:59
4
Solved
I have a small issue with the TimeSpan class where it can parse 23:59 but not 24:00.
Of course the client wants to enter 24:00 to indicate the end of the day rather than 23:59 or 00:00 as 00:00 in...
7
I have a ticks value of 28000000000 which should be 480 minutes but how can I be sure? How do I convert a ticks value to minutes?
1
When calculating the millisecond difference between two DateTime objects I always seem to get a number returned where the decimal part of the number is the same as the integer component of the numb...
3
Solved
I have a Timespan that I need to output in a particular format as shown below :-
TimeSpan TimeDifference = DateTime.Now - RandomDate;
I'm formatting the TimeSpan like this :-
string result = st...
1
Solved
When I try to store a TimeSpan value into ApplicationData Settings I get an error because TimeSpan cannot be serialized. This SO question shows how to handle it: How to serialize a TimeSpan to XML
...
Fribourg asked 18/12, 2012 at 16:41
2
Solved
I have a List<T> of available times within a 24 hour day, and two TimeSpans, minTime and maxTime.
I need to find a time of day within the List<T> that lands between the minTime and max...
© 2022 - 2024 — McMap. All rights reserved.