<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to IECStringUtils.FormatDateTime</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/23f23119a7/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/23f23119a7/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/23f23119a7/</id><updated>2025-10-07T09:05:10.382000Z</updated><subtitle>Recent posts to IECStringUtils.FormatDateTime</subtitle><entry><title>IECStringUtils.FormatDateTime</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/23f23119a7/?limit=25#7a51" rel="alternate"/><published>2025-10-07T09:05:10.382000Z</published><updated>2025-10-07T09:05:10.382000Z</updated><author><name>hteich</name><uri>https://forge.codesys.com/u/hteich/</uri></author><id>https://forge.codesys.com57b80b01c17ad0694254d6e2883c25ea59e4f247</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Does that actually work, though? Where do you put in the actual Date_Time value??&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>IECStringUtils.FormatDateTime</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/23f23119a7/?limit=25#e0b7" rel="alternate"/><published>2025-07-29T08:11:30.040000Z</published><updated>2025-07-29T08:11:30.040000Z</updated><author><name>TimvH</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.comeb92278892360290ba71e7a38f9b7420adb78915</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;There has been a fix in SP21. I tried it in this version with the option "Use unicodestring" enabled in the Visualization Manager and it worked if the variables used for the function are declared as WSTRING variables&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;wsFormat&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;WSTRING&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"%t&lt;/span&gt;&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;HH&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;mm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;ss&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nx"&gt;dd.MM.yyyy&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;wsTime&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;WSTRING&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nv"&gt;IECStringUtils&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;FormatDateTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;cbpResult&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;ADR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;wsTime&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;uiResultCapacity&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;SIZEOF&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;wsTime&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;cbpFormat&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;ADR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;wsFormat&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</summary></entry><entry><title>IECStringUtils.FormatDateTime</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/23f23119a7/?limit=25#de89" rel="alternate"/><published>2025-07-25T18:54:35.343000Z</published><updated>2025-07-25T18:54:35.343000Z</updated><author><name>bnewman</name><uri>https://forge.codesys.com/u/bnewman/</uri></author><id>https://forge.codesys.com3d95458cd4b0c8e3cf65c38e656eb9cd931d7a69</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Update as of 2025:&lt;/p&gt;
&lt;p&gt;This function (IECStringUtils.FormatDateTime) doesn't make any sense there isn't any parameter that accepts a Date_Time value.&lt;/p&gt;
&lt;p&gt;I have no idea what's purpose even is.&lt;/p&gt;
&lt;p&gt;I am going to use StuSprintf from the StringUtils library for this purpose.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>IECStringUtils.FormatDateTime</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/23f23119a7/?limit=25#2ae3" rel="alternate"/><published>2022-05-30T15:03:52.914000Z</published><updated>2022-05-30T15:03:52.914000Z</updated><author><name>lukas</name><uri>https://forge.codesys.com/u/lukas/</uri></author><id>https://forge.codesys.com9568ee218b35e4425144b1cb5c64fb2f6736eeb9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello all,&lt;br/&gt;
   there is lib IECStringUtils in Codesys that contains FormatDateTime function.&lt;/p&gt;
&lt;p&gt;It works just fine.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;sFormat := '%t[HH:mm:ss  dd. MM. yyyy]';&lt;/span&gt;
&lt;span class="err"&gt;sTime := DWORD_TO_STRING(dwTimeDateLocal);&lt;/span&gt;
&lt;span class="err"&gt;xFormatDateTimeOK := FormatDateTime(cbpResult := ADR(sTime), uiResultCapacity := SIZEOF(sTime), cbpFormat := ADR(sFormat));&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;sTime then contains 16:40:00  30. 05. 2022, so exactly what i wanted.&lt;/p&gt;
&lt;p&gt;But, when I set in Visualization Manager - General Settings - checkbox Use unicodestrings, this function returns in sTime undecoded number. Is this a bug?&lt;/p&gt;
&lt;p&gt;I know I can use '%t&lt;span&gt;[HH:mm:ss  dd. MM. yyyy]&lt;/span&gt;' directly in visu (it works ok in there), but I need date and time string for creating a filename.&lt;/p&gt;
&lt;p&gt;xFormatDateTimeOK is still FALSE (with or without "Use unicodestring" checked) - bug as well or i'm missing something?&lt;/p&gt;
&lt;p&gt;Thanks for reply, Lukas.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>