<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Convert OLE date (in seconds) to DD.MM.YYYY HH:MM:SS (scripting) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/225514#M44779</link>
    <description>&lt;P&gt;I &lt;STRIKE&gt;don't know if this will help at all, but here is a brut force way of doing the conversion.&amp;nbsp; Note that the initial setting of the JMP date value is in U.S.&amp;nbsp; numeric structure&lt;/STRIKE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;STRIKE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
JMPValue = 43717.479872;
// Add the number of seconds different from the JMPValue to the
// JMP date time value for 09.09.2019 11:31:01
JMPDateTime = JMPValue + 3650829743.52013;
// Display it's value using a standard JMP format
Show( Format( JMPDateTime, "d/m/y h:m:s" ) );
// Now show the same JMPDateTime but using a Custom
// format to change the value into exactly the desired
// structure

Show(
	Format(
		JMPDateTime,
		"Custom",
		Formula(
			Trim( Substr( " 0", -1 * Length( Char( Day( value ) ) ), 1) ) || Char( Day( value ) )
			|| "." ||
			Trim( Substr( " 0", -1 * Length( Char( Month( value ) ) ), 1) ) || Char( Month( value ) )
			|| "." ||
			Char( Year( value ) )
			|| " " ||
			Trim( Substr( " 0", -1 * Length( Char( Hour( value ) ) ), 1) ) || Char( Hour( value ) )
			|| ":" ||
			Trim( Substr( " 0", -1 * Length( Char( Minute( value ) ) ), 1) ) || Char( Minute( value ) )
			|| ":" ||
			Trim( Substr( " 0", -1 * Length( Char( Floor( Second( value ) ) ) ), 1) ) || Char( Floor( Second( value ) ) )
		),
		40
	)
);&lt;/CODE&gt;&lt;/STRIKE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRIKE&gt;Which yields the results&lt;/STRIKE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;STRIKE&gt;Format(JMPDateTime, "d/m/y h:m:s") = "09/09/2019 11:31:01 AM";
Format(JMPDateTime, "Custom", Formula(Trim(Substr(" 0", -1 * Length(Char(Day(value))), 1)) || Char(Day(value)) || "." || Trim(Substr(" 0", -1 * Length(Char(Month(value))), 1)) || Char(Month(value)) || "." || Char(Year(value)) || " " || Trim(Substr(" 0", -1 * Length(Char(Hour(value))), 1)) || Char(Hour(value)) || ":" || Trim(Substr(" 0", -1 * Length(Char(Minute(value))), 1)) || Char(Minute(value)) || ":" || Trim(Substr(" 0", -1 * Length(Char(Floor(Second(value)))), 1)) || Char(Floor(Second(value)))), 40) = "09.09.2019 11:31:01";&lt;/STRIKE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Sep 2019 15:17:03 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2019-09-12T15:17:03Z</dc:date>
    <item>
      <title>Convert OLE date (in seconds) to DD.MM.YYYY HH:MM:SS (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/225494#M44777</link>
      <description>&lt;P&gt;Hi JMP community,&lt;/P&gt;&lt;P&gt;Today I have a special challenge:&lt;/P&gt;&lt;P&gt;In JMP I have numeric entries (presumably OLE, German locale, in seconds). I know the corresponding correct values in EXCEL, e.g.&lt;/P&gt;&lt;P&gt;JMP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EXCEL&lt;/P&gt;&lt;P&gt;43717,479872 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09.09.2019 11:31:01&lt;/P&gt;&lt;P&gt;43717,479902 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09.09.2019 11:31:04&lt;/P&gt;&lt;P&gt;43717,479884 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09.09.2019 11:31:02&lt;/P&gt;&lt;P&gt;Could you show me a JSL way how to convert these JMP entries (in seconds) into the desired datetime format like shown in the EXCEL column? I tried several approaches but couldn't figure it out.&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 07:20:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/225494#M44777</guid>
      <dc:creator>Newbie2Jumpie</dc:creator>
      <dc:date>2019-09-12T07:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Convert OLE date (in seconds) to DD.MM.YYYY HH:MM:SS (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/225514#M44779</link>
      <description>&lt;P&gt;I &lt;STRIKE&gt;don't know if this will help at all, but here is a brut force way of doing the conversion.&amp;nbsp; Note that the initial setting of the JMP date value is in U.S.&amp;nbsp; numeric structure&lt;/STRIKE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;STRIKE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
JMPValue = 43717.479872;
// Add the number of seconds different from the JMPValue to the
// JMP date time value for 09.09.2019 11:31:01
JMPDateTime = JMPValue + 3650829743.52013;
// Display it's value using a standard JMP format
Show( Format( JMPDateTime, "d/m/y h:m:s" ) );
// Now show the same JMPDateTime but using a Custom
// format to change the value into exactly the desired
// structure

Show(
	Format(
		JMPDateTime,
		"Custom",
		Formula(
			Trim( Substr( " 0", -1 * Length( Char( Day( value ) ) ), 1) ) || Char( Day( value ) )
			|| "." ||
			Trim( Substr( " 0", -1 * Length( Char( Month( value ) ) ), 1) ) || Char( Month( value ) )
			|| "." ||
			Char( Year( value ) )
			|| " " ||
			Trim( Substr( " 0", -1 * Length( Char( Hour( value ) ) ), 1) ) || Char( Hour( value ) )
			|| ":" ||
			Trim( Substr( " 0", -1 * Length( Char( Minute( value ) ) ), 1) ) || Char( Minute( value ) )
			|| ":" ||
			Trim( Substr( " 0", -1 * Length( Char( Floor( Second( value ) ) ) ), 1) ) || Char( Floor( Second( value ) ) )
		),
		40
	)
);&lt;/CODE&gt;&lt;/STRIKE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRIKE&gt;Which yields the results&lt;/STRIKE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;STRIKE&gt;Format(JMPDateTime, "d/m/y h:m:s") = "09/09/2019 11:31:01 AM";
Format(JMPDateTime, "Custom", Formula(Trim(Substr(" 0", -1 * Length(Char(Day(value))), 1)) || Char(Day(value)) || "." || Trim(Substr(" 0", -1 * Length(Char(Month(value))), 1)) || Char(Month(value)) || "." || Char(Year(value)) || " " || Trim(Substr(" 0", -1 * Length(Char(Hour(value))), 1)) || Char(Hour(value)) || ":" || Trim(Substr(" 0", -1 * Length(Char(Minute(value))), 1)) || Char(Minute(value)) || ":" || Trim(Substr(" 0", -1 * Length(Char(Floor(Second(value)))), 1)) || Char(Floor(Second(value)))), 40) = "09.09.2019 11:31:01";&lt;/STRIKE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 15:17:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/225514#M44779</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-09-12T15:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Convert OLE date (in seconds) to DD.MM.YYYY HH:MM:SS (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/225533#M44784</link>
      <description>&lt;P&gt;Could you provide more information about the JMP values in seconds?&amp;nbsp; If I apply Jim's idea all three values are the same.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;jmp_list = {43717.479872, 43717.479902, 43717.479884};
excel_list = {};
for (i = 1, i &amp;lt;= nitems(jmp_list), i++,
	one_dt = jmp_list[i];
// Add the number of seconds different from the JMPValue to the
// JMP date time value for 09.09.2019 11:31:01
	jmp_dt = one_dt + 3650829743.52013;
// Display its value using a standard JMP format
	dtc = Format( jmp_dt, "d/m/y h:m:s" ) ;

	dtc = substitute(dtc, "/", ".");
	excel_list[i] = dtc;
);
show(excel_list);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;excel_list = {"09.09.2019 11:31:01 AM", "09.09.2019 11:31:01 AM", "09.09.2019 11:31:01 AM"};&lt;/PRE&gt;
&lt;P&gt;The first two entries are 3 seconds apart, but the numbers are .000030 apart&lt;/P&gt;
&lt;P&gt;The first and third entries are 1 second apart but the numbers are .000012 apart.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are the units of the "JMP values in seconds" column?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 13:02:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/225533#M44784</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2019-09-12T13:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Convert OLE date (in seconds) to DD.MM.YYYY HH:MM:SS (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/225550#M44786</link>
      <description>Background is, this is a special OLE based datetime value. As far I was&lt;BR /&gt;told it seems to be seconds after 1900. EXCEL imports these values&lt;BR /&gt;correctly (sample values on the right). JMP doesn't.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Let's just simplify:&lt;BR /&gt;&lt;BR /&gt;I don't mind whether the eventual JMP display format is US, international,&lt;BR /&gt;or European. Most important is a working conversion to a more&lt;BR /&gt;readable/common JMP datetime format. The EXCEL column shows what the&lt;BR /&gt;correct result should look like.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;BTW, the two approaches don't work properly. Both set all entries to&lt;BR /&gt;09.09.2019 11:31:01.&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Sep 2019 14:36:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/225550#M44786</guid>
      <dc:creator>Newbie2Jumpie</dc:creator>
      <dc:date>2019-09-12T14:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Convert OLE date (in seconds) to DD.MM.YYYY HH:MM:SS (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/225552#M44787</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14776"&gt;@Newbie2Jumpie&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are correct......I took the wrong approach in trying to solve the issue.&amp;nbsp; The date values you have are actually Excel date/time values.&amp;nbsp; They are based upon the number of days since 01JAN1900, &lt;FONT style="background-color: #ffffff;"&gt;(43717)&lt;/FONT&gt;, for the days, and a proportion of a day, (&lt;FONT style="background-color: #ffffff;"&gt;.479884&lt;/FONT&gt;), for the time and they start with day 1.&amp;nbsp; JMP base is the number of seconds since 01JAN1904 and starts at day 0.&amp;nbsp; So the conversion formula is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;in days(43717)-in days(1)-in years(4) + .479872*indays(1)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This can be displayed in the following JSL&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;format(in days(43717)-in days(1)-in years(4) + .479872*indays(1),"m/d/y h:m:s");

format(in days(43717)-in days(1)-in years(4) + .479902*indays(1),"m/d/y h:m:s");

format(in days(43717)-in days(1)-in years(4) + .479884*indays(1),"m/d/y h:m:s");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;format(in days(43717)-in days(1)-in years(4) + .479872*indays(1),"m/d/y h:m:s")
/*:

"09/09/2019 11:31:01 AM"
//:*/
format(in days(43717)-in days(1)-in years(4) + .479902*indays(1),"m/d/y h:m:s");
/*:

"09/09/2019 11:31:04 AM"
//:*/
format(in days(43717)-in days(1)-in years(4) + .479884*indays(1),"m/d/y h:m:s");
/*:

"09/09/2019 11:31:02 AM"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 15:13:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/225552#M44787</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-09-12T15:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Convert OLE date (in seconds) to DD.MM.YYYY HH:MM:SS (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/226556#M44944</link>
      <description>My solution:&lt;BR /&gt;&lt;BR /&gt;Tx' format approach:&lt;BR /&gt;&lt;BR /&gt;format(in days(43717)-in days(1)-in years(4) + .479872*indays(1),"m/d/y h:m:s");&lt;BR /&gt;&lt;BR /&gt;My computaion approach (assumes OLE timestring is character and&lt;BR /&gt;relevant info extracted into utility fields, not typo checked):&lt;BR /&gt;&lt;BR /&gt;new column("My_OLE",numeric,"continuous",formula(format(in&lt;BR /&gt;days(:"OLE_days"-in days(1)-in years(:"OLE_years") +&lt;BR /&gt;:"OLE_hhmmss"*indays(1),"d/m/y h:m:s"))) ;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Sep 2019 12:53:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/226556#M44944</guid>
      <dc:creator>Newbie2Jumpie</dc:creator>
      <dc:date>2019-09-20T12:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Convert OLE date (in seconds) to DD.MM.YYYY HH:MM:SS (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/502529#M73576</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14776"&gt;@Newbie2Jumpie&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;in fact this is only true for summertime timestamps. In wintertime the timestamps you create are -1 hour back.&lt;/P&gt;&lt;P&gt;I have the exact same problem like you and I'm getting data from a balance to a excel spreedsheet in the OLE timeformat.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was frustrated because all of my data seemed to be shifted by 1 hour in the winter months.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;Is there a way (built-in JSL function maybe?)&amp;nbsp; to check if a timestamp is in summer or winter time and than add/substract one hour?&lt;/P&gt;&lt;P&gt;Obviously there are a lot of countries in the world having this feature in there system:&amp;nbsp;&lt;A href="https://www.timeanddate.com/time/dst/2022.html" target="_blank" rel="noopener"&gt;https://www.timeanddate.com/time/dst/2022.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;so it should not only be a problem in Germany or Switzerland, where I am.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One can check if the timestamp is before the last sunday of march 2:00AM or after the last sunday of octover 3:00AM but this is kind of tricky, isn't it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 09:08:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/502529#M73576</guid>
      <dc:creator>christianguhr</dc:creator>
      <dc:date>2022-06-08T09:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: Convert OLE date (in seconds) to DD.MM.YYYY HH:MM:SS (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/502534#M73577</link>
      <description>&lt;P&gt;Checking timezones generally is very very tricky and error prone &lt;A href="https://www.youtube.com/watch?v=-5wpm-gesOY" target="_self"&gt;The Problem with Time &amp;amp; Timezones - Computerphile (youtube.com)&lt;/A&gt; . To my knowledge there is no built-in function in JMP to check for current time zone.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There might be powershell/commandline commands to get the operating systems timezone and check for day light saving time. After that you could use Run Command() to run those commands and parse the correct offset and add that to JMP's datetime.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 09:16:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/502534#M73577</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-06-08T09:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Convert OLE date (in seconds) to DD.MM.YYYY HH:MM:SS (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/502714#M73586</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;for the Tom Scott Video: Perfect.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is something in the wishlist:&amp;nbsp;&lt;A href="https://community.jmp.com/t5/JMP-Wish-List/Time-Zone-Conversion/idi-p/484479" target="_blank"&gt;https://community.jmp.com/t5/JMP-Wish-List/Time-Zone-Conversion/idi-p/484479&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe this will help us someday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greetings, Christian&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 12:26:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Convert-OLE-date-in-seconds-to-DD-MM-YYYY-HH-MM-SS-scripting/m-p/502714#M73586</guid>
      <dc:creator>christianguhr</dc:creator>
      <dc:date>2022-06-08T12:26:19Z</dc:date>
    </item>
  </channel>
</rss>

