locked
date time printing help RRS feed

  • Question

  • hours = time.TotalHours.ToString();
                minutes = time.TotalMinutes.ToString();
                seconds = time.TotalSeconds.ToString();
                millisecond = time.TotalMilliseconds.ToString();
    
                result.Text += "\nYour Age in Hours" + hours;
                result.Text += "\nMinutes Since your birth " + minutes;
                result.Text += "\nSeconds Since your birth " + seconds;
                result.Text += "\nMilliseconds Sice your birth " + millisecond;

    Your Age in Days : 8152.99999978015
    Your Age in Hours : 195671.999994724
    Minutes Since your birth : 11740319.9996834
    Seconds Since your birth : 704419199.981005
    Milliseconds Sice your birth : 704419199981.005

    i dont need point after values



    • Edited by luna_luna Friday, January 31, 2014 10:44 AM
    Friday, January 31, 2014 10:40 AM

Answers

  • Hi,

    You can use the C# built in String Formatter. Like the following

    hours = time.TotalHours.ToString("0");
    minutes
    = time.TotalMinutes.ToString("0");
    seconds
    = time.TotalSeconds.ToString("0");
    millisecond
    = time.TotalMilliseconds.ToString("0");


    My blog : http://thuruinhttp.wordpress.com

    Friday, January 31, 2014 10:57 AM
  • Hi

    You could also try this:     Convert.ToInt32(ValueHere);

    The result would be integer.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, February 5, 2014 8:15 AM
    Moderator

All replies

  • Hi,

    You can use the C# built in String Formatter. Like the following

    hours = time.TotalHours.ToString("0");
    minutes
    = time.TotalMinutes.ToString("0");
    seconds
    = time.TotalSeconds.ToString("0");
    millisecond
    = time.TotalMilliseconds.ToString("0");


    My blog : http://thuruinhttp.wordpress.com

    Friday, January 31, 2014 10:57 AM
  • Hi

    You could also try this:     Convert.ToInt32(ValueHere);

    The result would be integer.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, February 5, 2014 8:15 AM
    Moderator