Community
    • Login

    How to change/convert the format of a timestamp?

    Scheduled Pinned Locked Moved General Discussion
    38 Posts 6 Posters 16.1k Views 2 Watching
    Loading More Posts
    • 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.
    • Eko palypseE Offline
      Eko palypse @Meta Chuh
      last edited by

      @Meta-Chuh

      :-D - always reminds me of this

      Meta ChuhM 1 Reply Last reply Reply Quote 1
      • Meta ChuhM Offline
        Meta Chuh moderator @Eko palypse
        last edited by

        @Eko-palypse

        singing: ahaaaa, ahahahaaa … all the things i could do … ;-)

        Eko palypseE 1 Reply Last reply Reply Quote 1
        • Eko palypseE Offline
          Eko palypse @Meta Chuh
          last edited by

          @Meta-Chuh

          I don’t understand all of this but what I got makes me laughing … :-D

          Meta ChuhM 1 Reply Last reply Reply Quote 1
          • Meta ChuhM Offline
            Meta Chuh moderator @Eko palypse
            last edited by

            @Eko-palypse
            i also didn’t understand many of weird al yankovic’s insider jokes, but he made a lot of 80’s songs parodies, a funny one was “fat”, a parody of michael jacksons “bad” … or at least it used to be funny to me when i was a kid ;-)

            1 Reply Last reply Reply Quote 1
            • Meta ChuhM Offline
              Meta Chuh moderator @Dana Wright
              last edited by

              btw: my apologies to you @Dana-Wright if you had to read everything after your “Worked like a charm! Thank you very much!” and eko’s explanation.

              sometimes (but very few) we tend to have a little “after work chat” between regulars in public, which can be a bit off topic from time to time. i hope you didn’t mind.

              1 Reply Last reply Reply Quote 1
              • Meta ChuhM Offline
                Meta Chuh moderator
                last edited by Meta Chuh

                one more song and then it’s enough for today:

                >>> here’s a song <<< for @Scott-Sumner 😪😉😂

                Alan KilbornA 1 Reply Last reply Reply Quote 1
                • Alan KilbornA Offline
                  Alan Kilborn @Meta Chuh
                  last edited by

                  @Meta-Chuh

                  As valuable as Scott’s (and Claudia’s) posts were, we have some really good new posters about scripting (example Eko, and Peter is developing as a Python person), so let’s not be too sad if they decide not to return.

                  1 Reply Last reply Reply Quote 0
                  • guy038G Offline
                    guy038
                    last edited by guy038

                    Hello, @dana-wright, @eko-palypse, @alan-kilborn, @meta-chuh, @peterjones and All,

                    Just a bit late, but here are two regexes S/R which could achieve the goal !

                    Note that, regarding the initial timestamps, I will use the convention [M]MM:SS.mmm, where :

                    • [M]MM represents the number of minutes, from 00 to 119/179, with two or three digits

                    • SS represents the number of seconds, from 00 to 59, with two digits

                    • mmm represents the number of milliseconds, from 000 to 999, with three digits


                    Case A) If your file contains timestamps syntaxes, from 00:00.000 to 119:59.999, only ( so 0 <[M]MM < 2 hours ) , one solution could be :

                    • SEARCH A   (?<!:)(?:([0-5])|(6)|(7)|(8)|(9)|(10)|(11))(\d:\d{2}\.\d{3})(?=\s)

                    • REPLACE A (?{1}00:01):(?1\1)(?{2}0)(?{3}1)(?{4}2)(?{5}3)(?{6}4)(?{7}5)\8

                    Case B) If your file contains timestamps syntaxes, from 00:00.000 to 179:59.999, only ( so 0 < [M]MM < 3 hours ), a longer S/R is :

                    • SEARCH B   (?<!:)(?:([0-5])|((6)|(7)|(8)|(9)|(10)|(11))|((12)|(13)|(14)|(15)|(16)|(17)))(\d:\d{2}\.\d{3})(?=\s)

                    • REPLACE B (?{1}00)(?{2}01)(?{9}02):(?1\1)(?{3}0)(?{4}1)(?{5}2)(?{6}3)(?{7}4)(?{8}5)(?{10}0)(?{11}1)(?{12}2)(?{13}3)(?{14}4)(?{15}5)$16


                    As usual :

                    • Check the Wrap around option

                    • Select the Regular expression search mode

                    • Click on the Replace All button

                    Best Regards

                    guy038

                    P. S.

                    For instance :

                    • With the regexes A, the initial text, below :
                    00:00.000
                    23:52.984
                    39:43.529
                    59:59.999
                    60:00.000
                    78:08.168
                    91:38.524
                    103:05.216
                    111:41.465
                    119:59.999
                    

                    becomes :

                    00:00:00.000
                    00:23:52.984
                    00:39:43.529
                    00:59:59.999
                    01:00:00.000
                    01:18:08.168
                    01:31:38.524
                    01:43:05.216
                    01:51:41.465
                    01:59:59.999
                    
                    • With the regexes B, the following text :
                    00:00.000
                    23:52.984
                    39:43.529
                    59:59.999
                    60:00.000
                    78:08.168
                    91:38.524
                    103:05.216
                    111:41.465
                    119:59.999
                    120:00.000
                    147:33.150
                    160:00.058
                    179:59.999
                    

                    becomes :

                    00:00:00.000
                    00:23:52.984
                    00:39:43.529
                    00:59:59.999
                    01:00:00.000
                    01:18:08.168
                    01:31:38.524
                    01:43:05.216
                    01:51:41.465
                    01:59:59.999
                    02:00:00.000
                    02:27:33.150
                    02:40:00.058
                    02:59:59.999
                    
                    Meta ChuhM 1 Reply Last reply Reply Quote 2
                    • Meta ChuhM Offline
                      Meta Chuh moderator @guy038
                      last edited by

                      @guy038
                      it’s never too late, if people care … and thankfully many do 😃
                      thumbs up 👍

                      1 Reply Last reply Reply Quote 1
                      • PeterJonesP Offline
                        PeterJones
                        last edited by

                        Thank you, @guy038. I had been trying the notation similar to (?(1)00:01) in the replace, rather than (?{1}00:01), which is why I wasn’t able to get the conditional to work right.

                        1 Reply Last reply Reply Quote 2

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors