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

  • Home
  • SEARCH
  • 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 7458081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:24:12+00:00 2026-05-29T13:24:12+00:00

I have a decimal value (64.17 hours) and need to convert this to a

  • 0

I have a decimal value (64.17 hours) and need to convert this to a timestamp of hours, minutes and seconds but the hours value should show 64 not 16.

It should also not show the microseconds so 64.17 would be displayed as

64:10:12

Anyone help me on this? I also need to put it in an aggregate function (average in this case)

TimeSpan ts = new TimeSpan();
            ts.Add(TimeSpan.FromHours(ncr_time_lost));
            Console.WriteLine(ncr_time_lost + " = " + TimeSpan.FromHours(ncr_time_lost).ToString());

            return TimeSpan.FromHours(ncr_time_lost);
  • 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-05-29T13:24:13+00:00Added an answer on May 29, 2026 at 1:24 pm

    Update Working Code
    Add the below to the code part for the report

    Public Function TimeSpanToString(source as Timespan) as String
        Dim result As String
        result = Convert.ToInt32(source.TotalHours).ToString() & ":" & source.Minutes.ToString() & ":" & source.Seconds
    
        return result
    End Function
    

    Here is the answer with an example: TimeSpan.FromHours Method.

    Update:
    The format “64:10:12” can be done with the following code:

    static string TimeSpanToString(TimeSpan source)
    {
        string result = string.Format("{0}:{1}:{2}",
            (int)source.TotalHours,
            source.Minutes,
            source.Seconds);
        return result;
    }
    

    Update:
    Don’t know whether it’s correct, but try the following to use it from RDLC:

    public class SomeClass
    {
        public TimeSpan Time { get; set; }
    
        public string FormattedTime
        {
           get { return TimeSpanToString(Time); }
        }
    
        private static string TimeSpanToString(TimeSpan source)
        {
            // Code.
        }
    }
    

    Then try to get it from the report as "=Fields!FormattedDate.Value".

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

Sidebar

Related Questions

I have this hex value 93 which in decimal value should be 147. Since
Let I have decimal value of 14.8447 and I need this value 8447 in
I have been successful at rounding my value to one decimal point, but I
I have a decimal value of a utf-32 character: $a=21644; How can I convert
I need to have objects sorted by price (decimal) value for fast access. I
I have a varchar column that has generally has a decimal value, but some
I have seen posts which would fetch you pivot results but not unpivot, Need
The code below works fine but, in the textbox the decimal value has this
I have a string which holds a decimal value in it and I need
I have a textbox that gets a decimal value say 10500.00 the problem is

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.