<?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: How do I convert Date in seconds to use it in date difference method in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844304#M101827</link>
    <description>&lt;P&gt;Thankyou Jim , I am just wondering so do i take the day , hour and month out from the Date column's value&amp;nbsp; and then use datedmy . let me try this&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Feb 2025 16:16:18 GMT</pubDate>
    <dc:creator>HV0508</dc:creator>
    <dc:date>2025-02-25T16:16:18Z</dc:date>
    <item>
      <title>How do I convert Date in seconds to use it in date difference method</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844260#M101816</link>
      <description>&lt;P&gt;I have a code section where I have to create&amp;nbsp; new column hours by finding the difference between the current date and the minimum date (initial date) . But unfortunately i have tried a lot of things but i could not get to the solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Convert "Date" from Character to Date format
col = Column(dtCombined, "Date");
col &amp;lt;&amp;lt; Data Type("Numeric", Informat("y/m/d"), Format("d/m/y"));
col &amp;lt;&amp;lt; Modeling Type("Continuous");

//Finding the initial date 
initialDate = Col Minimum(dtCombined:Date);
Show("Earliest Date Found:", initialDate);

// Add "Hours" column as the first column
dtCombined &amp;lt;&amp;lt; New Column("Hours",
	Numeric,
	Continuous,
	Formula(Date Difference(:Date, initialDate, "Hour"))
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Following are the things that i have tried -&amp;nbsp;&lt;BR /&gt;None of these return 0 when initial date is subtracted with date value same as initial date -&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Show(Date Difference(24 - 09 - 2024, 3809980800, "Hour"));
Show(Date Difference(24 - 09 - 2024, As Date(3809980800), "Hour"));
Show(Date Difference(As Date(24 - 09 - 2024), 3809980800, "Hour"));
Show(Date Difference(24 - 09 - 2024, As Date(Format(3809980800, "d/m/y", 10)), "Hour"));
Show(Date Difference(24 - 09 - 2024, Informat("3809980800", "d/m/y"), "Hour"));
initialD = Format(3809980800 + Informat("01/01/1904", "m/d/y"), "d/m/y");
Show(initialD);
k = Format(3809980800, "d/m/y");
Show(k);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Feb 2025 15:28:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844260#M101816</guid>
      <dc:creator>HV0508</dc:creator>
      <dc:date>2025-02-25T15:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert Date in seconds to use it in date difference method</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844271#M101817</link>
      <description>&lt;P&gt;After you have your date in JMP's datenum format it should be easy as it is and usually Format Pattern is the way to go for that conversion.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1740494594124.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/73334i146C9E9B14740F24/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1740494594124.png" alt="jthi_0-1740494594124.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Can you provide example of your table with few of those date string values?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 14:44:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844271#M101817</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-02-25T14:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert Date in seconds to use it in date difference method</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844273#M101819</link>
      <description>&lt;P&gt;This JSL returns a value of 0&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Show( Date Difference( datedmy(24,09,2024), 3809980800, "Hour" ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Feb 2025 15:08:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844273#M101819</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-02-25T15:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert Date in seconds to use it in date difference method</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844277#M101821</link>
      <description>&lt;P&gt;24 - 09 - 2024 as a date is 12/31/1903 23:26:00. JMP Help does have quite ok documentation about date functions &lt;A href="https://www.jmp.com/support/help/en/18.1/#page/jmp/date-and-time-functions.shtml#" target="_blank"&gt;https://www.jmp.com/support/help/en/18.1/#page/jmp/date-and-time-functions.shtml#&lt;/A&gt;&amp;nbsp; as does Scripting Index&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1740497554589.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/73335i819C0B17AB75B0AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1740497554589.png" alt="jthi_0-1740497554589.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Below are few of the more simple simple options&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Date Difference(24Sep2024, 3809980800, "Hour");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Date Difference(Date DMY(24, 9, 2024), 3809980800, "Hour");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also don't forget to check what alignment does in Date Difference() (it defaults to "start").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 15:33:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844277#M101821</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-02-25T15:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert Date in seconds to use it in date difference method</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844301#M101825</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HV0508_0-1740499787713.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/73336i4011094BE422635A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HV0508_0-1740499787713.png" alt="HV0508_0-1740499787713.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HV0508_1-1740499813366.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/73337iFA6A252DC55A00FA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HV0508_1-1740499813366.png" alt="HV0508_1-1740499813366.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the original data , which i convert to numeric form to get the minimum date(initial date in code ) .&amp;nbsp;&lt;BR /&gt;Then I am using the below code to get the difference between the two . The thing is Date column's date is in d/m/y(&lt;SPAN&gt;24 - 09 - 2024&lt;/SPAN&gt;) form where as the initalDate is in seconds&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;Formula(Date Difference(:Date, initialDate, "Hour"))&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Feb 2025 16:15:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844301#M101825</guid>
      <dc:creator>HV0508</dc:creator>
      <dc:date>2025-02-25T16:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert Date in seconds to use it in date difference method</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844304#M101827</link>
      <description>&lt;P&gt;Thankyou Jim , I am just wondering so do i take the day , hour and month out from the Date column's value&amp;nbsp; and then use datedmy . let me try this&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 16:16:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844304#M101827</guid>
      <dc:creator>HV0508</dc:creator>
      <dc:date>2025-02-25T16:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert Date in seconds to use it in date difference method</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844305#M101828</link>
      <description>&lt;P&gt;Cool . Thankyou , let me try and get back&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 16:16:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844305#M101828</guid>
      <dc:creator>HV0508</dc:creator>
      <dc:date>2025-02-25T16:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert Date in seconds to use it in date difference method</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844306#M101829</link>
      <description>&lt;P&gt;Seconds, d/m/y, q/yyyy,... format doesn't matter as long as you have a date. JMP will handle them as seconds since midnight January 1, 1904 anyway (JMP Help tells you this).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are you trying to do? Find difference between dates? If you are trying to do that, then why are you comparing with ours instead of days? I did mention JMP Help and Scripting Index, both of those will explain what you can do with date difference and what the valid intervalNames are &lt;A href="https://www.jmp.com/support/help/en/18.1/#page/jmp/date-and-time-functions.shtml?os=win&amp;amp;source=application#ww2538966" target="_blank"&gt;https://www.jmp.com/support/help/en/18.1/#page/jmp/date-and-time-functions.shtml?os=win&amp;amp;source=application#ww2538966&lt;/A&gt; (Scripting Index has better documentation in this case...)&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 16:35:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-convert-Date-in-seconds-to-use-it-in-date-difference/m-p/844306#M101829</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-02-25T16:35:26Z</dc:date>
    </item>
  </channel>
</rss>

