Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8119063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:41:26+00:00 2026-06-06T04:41:26+00:00

I have an application where i show Flight Departure Date and Arrival Date and

  • 0

I have an application where i show Flight Departure Date and Arrival Date and Flight Time Duration.

For Flight Time Duration , i simply subtract dates which gives me TimeStamp like

TimeStamp duration = arrivalDate.subtract(departureDate);

so record is like

               Departure          Arrival                   Duration
               Sat 07:05A         Sat 09:20A                2h 15m
               Sat 10:10A         Sat 11:15A                1h 05m
               Sat 05:15P         Sat 07:16P                2h 01m
Total Duration                                              5h 21m

I have many such flight records and i need to show Total Flight Duration , for this
i simply add Time span like

TimeStamp totalDuration = totalDuration.Add(duration);

But i got a situation where totalDuration reaches a value like {1.02:10:00} and when trying to convert this value to DateTime like this

TotalConnectionTime = new DateTime(2012,06, 30,(int)totalDuration.TotalHours, totalDuration.Minutes, 0);

it gives error

“Hour, Minute, and Second parameters describe an un-representable DateTime.”

(int)totalDuration.TotalHours = 26 and this create problem

I need to covert to {1.02:10:00} to 26h 10m which means 1 Day = 24 hours + 2 hours + 10 min

Hope i clear my point.

Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:41:28+00:00Added an answer on June 6, 2026 at 4:41 am

    Anil,

    Bqased on the comments above, I’d suggest saving a DateTime as the Departutre time (UTC) and then saving the minutes as an integer column. You can then calculate the offset as required. Below is a little console app to demonstrate the timespan usage, based on your example:

    class Program
    {
        static void Main(string[] args)
        {
            TimeSpan timeSpan = new TimeSpan(0,1570,0);
            var stringDisplay = string.Format("{0}:{1}:{2}", timeSpan.Days, timeSpan.Hours, timeSpan.Minutes);
            Console.WriteLine(stringDisplay);
            Console.ReadKey();
        }
    }
    

    this produces a result of : 1:2:10 (1 day, 2 hours and 10 minutes).

    this should work well for you when adding to your initial Departure time, i.e.:

    DateTime departure = new DateTime(2012, 6, 21, 7, 30, 0);
    DateTime completeJourney = departure.Add(timeSpan);
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a requirement in my application to show date and time. I am
i have created an application which show data from user current location. I want
I have an application in which I have to show the alerts for user
I have an Automator Application containing the action Show Growl Notification, which is always
I have an application on which I show configuration panel (QFrame) to setup the
I have an Application which uses a Slider to show the progress of a
I have an application in which I need to show some dynamic bar graphs
i have one application in iphone in which i have to show notification when
I have an application which downloads some data and I want to show that
I have one Application in which i have to show All wall Post of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.