<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to change&#x2F;convert the format of a timestamp?]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I could use some help please.</p>
<p dir="auto">I need to convert the format of timestamps in a text file as follows:</p>
<p dir="auto">From old format:<br />
78:08.706 --&gt; 78:18.550</p>
<p dir="auto">To new format:<br />
01:18:08.706 --&gt; 01:18:10.550</p>
<p dir="auto">Is this possible in Notepad++? I’m using version v7.5.1 (32-bit)</p>
<p dir="auto">Thanks in advance for any help.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/17005/how-to-change-convert-the-format-of-a-timestamp</link><generator>RSS for Node</generator><lastBuildDate>Fri, 15 May 2026 04:52:28 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/17005.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 25 Jan 2019 19:31:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Mon, 28 Jan 2019 01:06:20 GMT]]></title><description><![CDATA[<p dir="auto">Thank you, <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>.  I had been trying the notation similar to <code>(?(1)00:01)</code> in the replace, rather than <code>(?{1}00:01)</code>, which is why I wasn’t able to get the conditional to work right.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/39038</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/39038</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 28 Jan 2019 01:06:20 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Sun, 27 Jan 2019 20:40:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a><br />
it’s never too late, if people care … and thankfully many do 😃<br />
thumbs up 👍</p>
]]></description><link>https://community.notepad-plus-plus.org/post/39023</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/39023</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Sun, 27 Jan 2019 20:40:46 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Sun, 27 Jan 2019 22:12:48 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/dana-wright" aria-label="Profile: dana-wright">@<bdi>dana-wright</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: eko-palypse">@<bdi>eko-palypse</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/meta-chuh" aria-label="Profile: meta-chuh">@<bdi>meta-chuh</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">Just a bit late, but here are <strong>two</strong> regexes S/R which could achieve the goal !</p>
<p dir="auto">Note that, regarding the <strong>initial</strong> timestamps, I will use the <strong>convention</strong> <strong><code>[M]MM:SS.mmm</code></strong>, where :</p>
<ul>
<li>
<p dir="auto"><strong><code>[M]MM</code></strong> represents the number of <strong>minutes</strong>, from <strong><code>00</code></strong> to <strong><code>119</code></strong>/<strong><code>179</code></strong>, with <strong>two</strong> or <strong>three</strong> digits</p>
</li>
<li>
<p dir="auto"><strong><code>SS</code></strong> represents the number of <strong>seconds</strong>, from <strong><code>00</code></strong> to <strong><code>59</code></strong>, with <strong>two</strong> digits</p>
</li>
<li>
<p dir="auto"><strong><code>mmm</code></strong> represents the number of <strong>milliseconds</strong>, from <strong><code>000</code></strong> to <strong><code>999</code></strong>, with <strong>three</strong> digits</p>
</li>
</ul>
<hr />
<p dir="auto">Case <strong>A</strong>) If your file contains <strong>timestamps</strong> syntaxes, from <strong><code>00:00.000</code></strong> to <strong><code>119:59.999</code></strong>, <strong>only</strong> ( so <strong><code>0 &lt;[M]MM &lt; 2 hours</code></strong> ) , one solution could be :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong>A</strong>   <strong><code>(?&lt;!:)(?:([0-5])|(6)|(7)|(8)|(9)|(10)|(11))(\d:\d{2}\.\d{3})(?=\s)</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong>A</strong> <strong><code>(?{1}00:01):(?1\1)(?{2}0)(?{3}1)(?{4}2)(?{5}3)(?{6}4)(?{7}5)\8</code></strong></p>
</li>
</ul>
<p dir="auto">Case <strong>B</strong>) If your file contains <strong>timestamps</strong> syntaxes, from <strong><code>00:00.000</code></strong> to <strong><code>179:59.999</code></strong>, <strong>only</strong> ( so <strong><code>0 &lt; [M]MM &lt; 3 hours</code></strong> ), a <strong>longer</strong> S/R  is :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong>B</strong>   <strong><code>(?&lt;!:)(?:([0-5])|((6)|(7)|(8)|(9)|(10)|(11))|((12)|(13)|(14)|(15)|(16)|(17)))(\d:\d{2}\.\d{3})(?=\s)</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong>B</strong> <strong><code>(?{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</code></strong></p>
</li>
</ul>
<hr />
<p dir="auto">As usual :</p>
<ul>
<li>
<p dir="auto">Check the <strong><code>Wrap around</code></strong> option</p>
</li>
<li>
<p dir="auto">Select the <strong><code>Regular expression</code></strong> search mode</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Replace All</code></strong> button</p>
</li>
</ul>
<p dir="auto">Best Regards</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P. S.</strong></p>
<p dir="auto">For instance :</p>
<ul>
<li>With the regexes <strong>A</strong>, the <strong>initial</strong> text, below :</li>
</ul>
<pre><code class="language-diff">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
</code></pre>
<p dir="auto">becomes :</p>
<pre><code class="language-diff">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
</code></pre>
<ul>
<li>With the regexes <strong>B</strong>, the following text :</li>
</ul>
<pre><code class="language-diff">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
</code></pre>
<p dir="auto">becomes :</p>
<pre><code class="language-diff">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
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/39018</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/39018</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 27 Jan 2019 22:12:48 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Sat, 26 Jan 2019 14:24:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/meta-chuh" aria-label="Profile: Meta-Chuh">@<bdi>Meta-Chuh</bdi></a></p>
<p dir="auto">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.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38990</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38990</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 26 Jan 2019 14:24:52 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Sat, 26 Jan 2019 00:50:25 GMT]]></title><description><![CDATA[<p dir="auto">one more song and then it’s enough for today:</p>
<p dir="auto"><a href="https://www.youtube.com/watch?v=aeeJhEpeUfc" rel="nofollow ugc">&gt;&gt;&gt; here’s a song &lt;&lt;&lt;</a> for <a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: Scott-Sumner">@<bdi>Scott-Sumner</bdi></a> 😪😉😂</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38986</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38986</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Sat, 26 Jan 2019 00:50:25 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 22:41:13 GMT]]></title><description><![CDATA[<p dir="auto">btw: my apologies to you <a class="plugin-mentions-user plugin-mentions-a" href="/user/dana-wright" aria-label="Profile: Dana-Wright">@<bdi>Dana-Wright</bdi></a> if you had to read everything after your “Worked like a charm! Thank you very much!” and eko’s explanation.</p>
<p dir="auto">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.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38984</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38984</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Fri, 25 Jan 2019 22:41:13 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 22:27:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a><br />
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 <a href="https://www.youtube.com/watch?v=t2mU6USTBRE" rel="nofollow ugc">“fat”, a parody of michael jacksons “bad”</a> … or at least it used to be funny to me when i was a kid ;-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38983</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38983</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Fri, 25 Jan 2019 22:27:50 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 22:13:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/meta-chuh" aria-label="Profile: Meta-Chuh">@<bdi>Meta-Chuh</bdi></a></p>
<p dir="auto">I don’t understand all of <a href="https://tinyurl.com/y7srx75d" rel="nofollow ugc">this</a> but what I got makes me laughing … :-D</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38982</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38982</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Fri, 25 Jan 2019 22:13:09 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 22:07:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a></p>
<p dir="auto">singing: ahaaaa, ahahahaaa … all the things i could do … ;-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38981</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38981</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Fri, 25 Jan 2019 22:07:54 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 22:04:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/meta-chuh" aria-label="Profile: Meta-Chuh">@<bdi>Meta-Chuh</bdi></a></p>
<p dir="auto">:-D - always reminds me of <a href="https://tinyurl.com/bq8rwqv" rel="nofollow ugc">this</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/38980</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38980</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Fri, 25 Jan 2019 22:04:00 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 21:56:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a></p>
<blockquote>
<p dir="auto">I’m trying to avoid function lookups as those are expensive …</p>
</blockquote>
<p dir="auto">yes, i’m a bit short on money too at the moment … and don’t even dare to give me an (s.h) for this comment 😉</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38979</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38979</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Fri, 25 Jan 2019 21:56:40 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 21:54:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a> ,</p>
<p dir="auto">Indeed, there are always more formats that might exist.  I’ve only seen colon-separated in <code>.srt</code> files, so I think that keeping it generic enough that it won’t mess up an existing <code>.srt</code>, even if it does have some with hours and some without.</p>
<p dir="auto">BTW: I had forgotten why I included the <code>[:\d]</code> rather than just <code>:</code> in my negative lookbehind: without the <code>\d</code> in the character class, <code>1:15:00.000</code> (which shouldn’t match) would partially match on <code>5:00.000</code>, which would be even worse.</p>
<p dir="auto">And running a test with <code>1:15:00.000</code>, even with your simpler expression, works correctly (ie, doesn’t try to change it) – ahh, that’s because the minutes are less than 60.  I guess unless there’s a strange <code>1:65:00.000</code>, yours won’t be a problem.  I guess yours is generic enough.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38978</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38978</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 25 Jan 2019 21:54:24 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 21:48:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a></p>
<p dir="auto">YES - this is a bug it should &gt; 59 - omg.<br />
About mixed data you are right but this is always the question what if it looked like<br />
hh.mm.ss.msec …</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38976</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38976</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Fri, 25 Jan 2019 21:48:15 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 21:45:16 GMT]]></title><description><![CDATA[<p dir="auto">My two comments would be:</p>
<ol>
<li><code>if min &gt; 60:</code> = if the data is <code>60:00.000</code>, it wouldn’t change.  Make it <code>if min &gt;=60:</code></li>
<li>If the OP (or someone else) has mixed data, or had partially changed them, and came back later and tried the same script, weird stuff will happen.  I’d recommend: <code>editor.rereplace('(?&lt;![:\d])\d+:\d+\.\d+',change_format)</code>, which adds a negative lookbehind to not match if there’s a colon or another digit before the \d+</li>
</ol>
]]></description><link>https://community.notepad-plus-plus.org/post/38975</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38975</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 25 Jan 2019 21:45:16 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 21:45:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a></p>
<p dir="auto">so it is still a little bit faster - to be honest, haven’t expected it.</p>
<p dir="auto">looped 1000 times over the same text<br />
16.7720000744  &lt;-- return m.group(0)<br />
16.6819999218 &lt;- return ‘{}:{}’.format(*parts[:])</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38974</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38974</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Fri, 25 Jan 2019 21:45:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 21:41:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a></p>
<p dir="auto">Okay…so I didn’t follow any of that, but I look forward to the come back.  :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38972</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38972</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 25 Jan 2019 21:41:25 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 21:38:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a></p>
<p dir="auto">actually I’m trying to avoid function lookups as those are expensive, especially when it involves<br />
Python-&gt;C-&gt;Python conversion. But I must admit, in this case I don’t think that I gain any performance improvement, it might be even slower. Let’s test it. Will come back.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38970</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38970</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Fri, 25 Jan 2019 21:38:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 21:32:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a></p>
<p dir="auto">Maybe I misunderstood the intent of the return line I called out.  I was thinking that it is simply putting back together the original text but I didn’t look at the OP’s data or problem description all that closely.  I guess you would have returned m.group(0) if that were the case.</p>
<p dir="auto">Anyway, a replace function could have some logic that in certain cases it would not change the original text.  Returning None (or even, gasp, falling off the end of the function without returning anything) could be that signal.  I certainly did not try editor.rereplace() in that manner, maybe it already works that way.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38968</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38968</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 25 Jan 2019 21:32:24 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 21:14:35 GMT]]></title><description><![CDATA[<p dir="auto">you are absolutely correct - this survived the test when having hh::mm::ss::msec :-)<br />
But python slicing is rescuing me :-D</p>
<p dir="auto">I don’t understand the none return - I mean, why would you want to replace something with None<br />
where None means don’t replace anything? Which case do you have in mind?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38967</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38967</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Fri, 25 Jan 2019 21:14:35 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 21:08:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a> said:</p>
<blockquote>
<p dir="auto">That’s it.</p>
</blockquote>
<p dir="auto">Well…you didn’t explain the <code>else</code> part, and that’s where I have a question.  I would do it this way and I don’t know why you did it differently:</p>
<p dir="auto"><code>return '{}:{}'.format(*parts)</code></p>
<p dir="auto">I just had the thought that it would be nice if <code>editor.rereplace()</code> would take a replace function returning <code>None</code> as a signal to not do any replacement.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38966</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38966</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 25 Jan 2019 21:08:14 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 20:58:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dana-wright" aria-label="Profile: Dana-Wright">@<bdi>Dana-Wright</bdi></a></p>
<p dir="auto">this is quite easy.<br />
editor is a object exposed by pythonscript plugin which can manipulate the scintilla component used by notepad++.<br />
rereplace is the method which allows to have the first parameter being a regular expression and<br />
the second parameter being a function which is called for each match of the regex.</p>
<p dir="auto">The function change_format gets the match object in variable m<br />
As no regular expression matching group has been defined everything should be accessible in group 0.<br />
<code>parts = m.group(0).split(':')</code><br />
split what has been reported in match object by colon and return a list in variable parts<br />
<code>min = int(parts[0])</code><br />
take the first element in that list and convert it to an integer, save it in variable min<br />
<code>if min &gt; 60:</code><br />
if min greater than 60 we need to do something, if not else branch gets executed<br />
<code>real_minute = min % 60</code><br />
real_minute will get the remainder of division by 60<br />
<code>hours = min / 60</code><br />
hours the result of division by 60<br />
<code>return '{:02}:{:02}:{}'.format(hours, real_minute, parts[1])</code><br />
return the new string.<br />
<code>:02</code> means that we want to have it in two digit format 1-&gt;01 but 10-&gt;10 …<br />
That’s it.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38960</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38960</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Fri, 25 Jan 2019 20:58:02 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 20:48:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a> Worked like a charm! Thank you very much!</p>
<p dir="auto">Now I need to analyze this and figure it out how it was done.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38957</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38957</guid><dc:creator><![CDATA[Dana Wright]]></dc:creator><pubDate>Fri, 25 Jan 2019 20:48:17 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 20:34:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a> thanks. I’ll give it a try.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38953</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38953</guid><dc:creator><![CDATA[Dana Wright]]></dc:creator><pubDate>Fri, 25 Jan 2019 20:34:08 GMT</pubDate></item><item><title><![CDATA[Reply to How to change&#x2F;convert the format of a timestamp? on Fri, 25 Jan 2019 20:30:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dana-wright" aria-label="Profile: Dana-Wright">@<bdi>Dana-Wright</bdi></a></p>
<p dir="auto">I guess this python script should do the job</p>
<pre><code>def change_format(m):
    parts = m.group(0).split(':')
    min = int(parts[0])
    if min &gt; 60:
        real_minute = min % 60
        hours = min / 60
        return '{:02}:{:02}:{}'.format(hours, real_minute, parts[1])
    else:
        return '{}:{}'.format(*parts[:])
    
    
editor.rereplace('\d+:\d+\.\d+',change_format)
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/38952</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38952</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Fri, 25 Jan 2019 20:30:52 GMT</pubDate></item></channel></rss>