TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vishwas Kadamannaya
1.6k
122
142.6k
Time Span Diffrences Problem
Apr 5 2011 1:51 AM
Hi All,
I have a datatable that contains travel details
TravelDate
Source
Destination
DepartureTime
ArrivalTime
Duration
10:00:00
12:00:00
2
12:00:00
1:00:00
-11
I am getting all the values in datatable except "Duration", I need to calculate duration based on Departure and Arrival Time .
I am using the below step to do that but some time it gives wrong values
Foreach(DataRow dr in dt.Rows)
{
TimeSpan ts1 = TimeSpan.Parse(dr["DepartureTime"].ToString()); TimeSpan ts2 = TimeSpan.Parse(dr["ArrivalTime"].ToString());
TimeSpan ts3 = ts2.Subtract(ts1);
dr["Duration"]=ts3.ToString();
}
In second row it gives wrong value . How to rectify this..
Thanks in Advance
Reply
Answers (
3
)
Extract data from One dataGrid into another DataGrid.
hai ....