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. General Programming
  3. C#
  4. Milla Seconds in DateTime.Now

Milla Seconds in DateTime.Now

Scheduled Pinned Locked Moved C#
question
8 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.
  • E Offline
    E Offline
    eggie5
    wrote on last edited by
    #1

    Can DateTime.Now display millaseconds? I have... DateTime.Now.ToString("hh:mm:ss"); what abrevation do I put in for millaseconds? /\ |_ E X E GG

    D 1 Reply Last reply
    0
    • E eggie5

      Can DateTime.Now display millaseconds? I have... DateTime.Now.ToString("hh:mm:ss"); what abrevation do I put in for millaseconds? /\ |_ E X E GG

      D Offline
      D Offline
      dynamic
      wrote on last edited by
      #2

      Vb.Net:


      Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click   
           MessageBox.Show(DateAndTime.Now.Ticks)   
       End Sub   
      

      :) Vb:


      Public Function TwinsOnWay(ByVal twins As String) As String
      Select Case twins
      Case "Gender"
      Return "Two Girls"
      End Select
      End Function


      D 1 Reply Last reply
      0
      • D dynamic

        Vb.Net:


        Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click   
             MessageBox.Show(DateAndTime.Now.Ticks)   
         End Sub   
        

        :) Vb:


        Public Function TwinsOnWay(ByVal twins As String) As String
        Select Case twins
        Case "Gender"
        Return "Two Girls"
        End Select
        End Function


        D Offline
        D Offline
        dynamic
        wrote on last edited by
        #3

        might help if it's C# code lol : C#:


        private void button4_Click(object sender, System.EventArgs e)
        {
        MessageBox.Show(DateTime.Now.Ticks.ToString());
        }


        there ya go :) Vb:


        Public Function TwinsOnWay(ByVal twins As String) As String
        Select Case twins
        Case "Gender"
        Return "Two Girls"
        End Select
        End Function


        E L 2 Replies Last reply
        0
        • D dynamic

          might help if it's C# code lol : C#:


          private void button4_Click(object sender, System.EventArgs e)
          {
          MessageBox.Show(DateTime.Now.Ticks.ToString());
          }


          there ya go :) Vb:


          Public Function TwinsOnWay(ByVal twins As String) As String
          Select Case twins
          Case "Gender"
          Return "Two Girls"
          End Select
          End Function


          E Offline
          E Offline
          eggie5
          wrote on last edited by
          #4

          ok... is that in milla seconds? or nano seconds??? and I need it to look like this minutes:seconds:millaseconds... so, DateTime.Now.ToString("mm:ss:??"); how would I do that? /\ |_ E X E GG

          R 1 Reply Last reply
          0
          • E eggie5

            ok... is that in milla seconds? or nano seconds??? and I need it to look like this minutes:seconds:millaseconds... so, DateTime.Now.ToString("mm:ss:??"); how would I do that? /\ |_ E X E GG

            R Offline
            R Offline
            Rocky Moore
            wrote on last edited by
            #5

            You might look at: DateTime.Now.ToString("mm:ss:fffffff"); Rocky Moore <><

            E 1 Reply Last reply
            0
            • R Rocky Moore

              You might look at: DateTime.Now.ToString("mm:ss:fffffff"); Rocky Moore <><

              E Offline
              E Offline
              eggie5
              wrote on last edited by
              #6

              that's exactly what I wanted. thanks. /\ |_ E X E GG

              1 Reply Last reply
              0
              • D dynamic

                might help if it's C# code lol : C#:


                private void button4_Click(object sender, System.EventArgs e)
                {
                MessageBox.Show(DateTime.Now.Ticks.ToString());
                }


                there ya go :) Vb:


                Public Function TwinsOnWay(ByVal twins As String) As String
                Select Case twins
                Case "Gender"
                Return "Two Girls"
                End Select
                End Function


                L Offline
                L Offline
                leppie
                wrote on last edited by
                #7

                dynamic wrote: DateTime.Now.Ticks Ticks a machine dependent timing resolution. Commonly = 10ms. leppie::AllocCPArticle(Generic DFA State Machine for .NET);

                S 1 Reply Last reply
                0
                • L leppie

                  dynamic wrote: DateTime.Now.Ticks Ticks a machine dependent timing resolution. Commonly = 10ms. leppie::AllocCPArticle(Generic DFA State Machine for .NET);

                  S Offline
                  S Offline
                  StealthyMark
                  wrote on last edited by
                  #8

                  In the DateTime structure, one Tick always equals 100 ns (100 nanoseconds = 0.1 mikroseconds = 0.0001 milliseconds). But as you said, the actual resolution is somewhat lower.

                  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