<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to timer to string</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/39a72ae05c/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/39a72ae05c/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/39a72ae05c/</id><updated>2020-02-27T13:59:23.252000Z</updated><subtitle>Recent posts to timer to string</subtitle><entry><title>timer to string</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/39a72ae05c/?limit=25#556a" rel="alternate"/><published>2020-02-27T13:59:23.252000Z</published><updated>2020-02-27T13:59:23.252000Z</updated><author><name>josepmariarams</name><uri>https://forge.codesys.com/u/josepmariarams/</uri></author><id>https://forge.codesys.com6851846eafeb45a53f4a5cef436a8bf236c64550</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Or, you can do:&lt;/p&gt;
&lt;p&gt;a:time;&lt;/p&gt;
&lt;p&gt;a:=a/1000;&lt;/p&gt;
&lt;p&gt;and after&lt;/p&gt;
&lt;p&gt;a:=a *1000&lt;/p&gt;
&lt;p&gt;as a is an integer kind...&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>timer to string</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/39a72ae05c/?limit=25#28f8" rel="alternate"/><published>2020-02-27T13:59:22.938000Z</published><updated>2020-02-27T13:59:22.938000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com1117f78eb978f077a26615d89d59bea449474326</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; scott_cunningham&lt;/p&gt;
&lt;p&gt;You could check the OSCAT library - see CoDeSys store.  Or, this is easy enough to roll your own.  Here is one way:&lt;/p&gt;
&lt;p&gt;TOD is a nice format for this (TOD#hh:mm:ss.mmm).  Basically convert TIME to TOD to STRING and trim it for the answer.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;FUNCTION&lt;/span&gt; &lt;span class="nt"&gt;CleanTime&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;STRING&lt;/span&gt;
&lt;span class="nt"&gt;VAR_INPUT&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;TimeValue&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;TIME&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;END_VAR&lt;/span&gt;
&lt;span class="nt"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;MyTOD&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;TOD&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;MyStr&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;STRING&lt;/span&gt;&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="nt"&gt;lose&lt;/span&gt; &lt;span class="nt"&gt;the&lt;/span&gt; &lt;span class="nt"&gt;milliseconds&lt;/span&gt;
&lt;span class="nt"&gt;END_VAR&lt;/span&gt;
&lt;span class="nt"&gt;MyTOD&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nt"&gt;TIME_TO_TOD&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;TimeValue&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;MyStr&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nt"&gt;TOD_TO_STRING&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;MyTOD&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;CleanTime&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nt"&gt;Standard&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;RIGHT&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;STR&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;MyStr&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;8&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;So now, you can just do:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;Pretty&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;CleanTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Timer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ET&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>timer to string</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/39a72ae05c/?limit=25#2546" rel="alternate"/><published>2020-02-27T13:59:22.669000Z</published><updated>2020-02-27T13:59:22.669000Z</updated><author><name>jeffcoll</name><uri>https://forge.codesys.com/u/jeffcoll/</uri></author><id>https://forge.codesys.com87d283ec9a10d15a206b625373e9bfff5b4f90ea</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Best,&lt;/p&gt;
&lt;p&gt;I have the following problem, I now have a timer, where I use the ET on a screen that I convert to a string, but unfortunately I see the following 24m30s490ms, is there a possibility to defend the 490ms defenitively,?&lt;/p&gt;
&lt;p&gt;Br&lt;br/&gt;
Jeffrey Collewijn&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>