Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. problem in getting the value in minutes and seconds

problem in getting the value in minutes and seconds

Scheduled Pinned Locked Moved ASP.NET
sharepointhelptutorialquestion
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Amit Spadez
    wrote on last edited by
    #1

    hello all I have taken a variable (int) having value as 100. Now I want to convert that value into Datetime in 1 minute 40 seconds a form. could anyone tell me how to convert the static integer value into datetime value sp that i could use that value in my project?? Thanks in advance

    S N H 3 Replies Last reply
    0
    • A Amit Spadez

      hello all I have taken a variable (int) having value as 100. Now I want to convert that value into Datetime in 1 minute 40 seconds a form. could anyone tell me how to convert the static integer value into datetime value sp that i could use that value in my project?? Thanks in advance

      S Offline
      S Offline
      Sandeep Mewara
      wrote on last edited by
      #2

      Why don't you create your own method with the logic of getting time out of given minutes? Using all the known things like... 1 day=24 hours, 1 hour = 60 min, 1 min=60 sec... you can do it!

      A 1 Reply Last reply
      0
      • S Sandeep Mewara

        Why don't you create your own method with the logic of getting time out of given minutes? Using all the known things like... 1 day=24 hours, 1 hour = 60 min, 1 min=60 sec... you can do it!

        A Offline
        A Offline
        Amit Spadez
        wrote on last edited by
        #3

        I have taken ajax timer control and in the "timer1_tick" event,its time interval is 1000 meaning that it will tick every second Now, my code is class abc { static int countdown = 100; protected void page_load() { } timer1_tick() { countdown--; label.Text = countdown.ToString() + "seconds remaining"; } } Now I want that label.Text should display 100 as 1 minutes 40 seconds after 1 tick it should display 1 minute 39 sec.. after 2nd tick 1 minute 38 seconds and so on... for that I want 100 value in the datetime. plz help

        1 Reply Last reply
        0
        • A Amit Spadez

          hello all I have taken a variable (int) having value as 100. Now I want to convert that value into Datetime in 1 minute 40 seconds a form. could anyone tell me how to convert the static integer value into datetime value sp that i could use that value in my project?? Thanks in advance

          N Offline
          N Offline
          nish111
          wrote on last edited by
          #4

          It's even easier to get the time in seconds or minutes by writing your own custom function

          A 1 Reply Last reply
          0
          • N nish111

            It's even easier to get the time in seconds or minutes by writing your own custom function

            A Offline
            A Offline
            Amit Spadez
            wrote on last edited by
            #5

            could you give one example for that

            N 1 Reply Last reply
            0
            • A Amit Spadez

              could you give one example for that

              N Offline
              N Offline
              nagendrathecoder
              wrote on last edited by
              #6

              Its very simple buddy.

              int min = 100/60;
              int sec = 100%60;

              just do like this.

              1 Reply Last reply
              0
              • A Amit Spadez

                hello all I have taken a variable (int) having value as 100. Now I want to convert that value into Datetime in 1 minute 40 seconds a form. could anyone tell me how to convert the static integer value into datetime value sp that i could use that value in my project?? Thanks in advance

                H Offline
                H Offline
                hb52134214
                wrote on last edited by
                #7

                Do you really want a date and time? I think what you are seeking is a TimeSpan. TimeSpan x = TimeSpan.FromSeconds(100);

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups