<?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 round up or round down dates? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-round-up-or-round-down-dates/m-p/343939#M59343</link>
    <description>&lt;P&gt;Most likely there is cleaner/more efficient way to do this but these should work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rounded opentime:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(In Hours(1) &amp;lt;= Time Of Day(:Opentime) &amp;lt; In Hours(4),
	(:Opentime - Time Of Day(:Opentime)) + In Hours(4),
	:Opentime
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Same idea for rounded closetime:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(In Hours(1) &amp;lt;= Time Of Day(:Closetime) &amp;lt; In Hours(4),
	(:Closetime - Time Of Day(:Closetime)) + In Hours(1),
	:Closetime
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Solution built on the formulas "pre-made" by JMP when you right click on column name on date column for &lt;EM&gt;Date&lt;/EM&gt; and &lt;EM&gt;Time Of Day&lt;/EM&gt;:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1608667237971.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/29075iE7EF0BC2D706755E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1608667237971.png" alt="jthi_1-1608667237971.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Dec 2020 20:03:08 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2020-12-22T20:03:08Z</dc:date>
    <item>
      <title>How do I round up or round down dates?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-round-up-or-round-down-dates/m-p/343897#M59340</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;If I have a bunch of&amp;nbsp;Opentimes in the format MMDDYYYY hh:mm and I would like to fix any of these dates that&amp;nbsp;occur between the hours of 1am and 3:59am to "round up" to 4am.&lt;/P&gt;&lt;P&gt;In other words if my&amp;nbsp;Opentime is 10/09/2020 3:12 AM,&amp;nbsp;I need that to round up to 10/09/2020 4:00 AM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Conversely I have Closetimes in same format and I would like to fix any of these dates that&amp;nbsp;occur between the hours of 1am and 3:59am to "round down" to 1am.&lt;/P&gt;&lt;P&gt;In other words if my Closetimes is 10/09/2020 3:12 AM, I need that to round&amp;nbsp;down to 10/09/2020 1:00 AM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;use the formula editor in JMP for all my formulae so if I can paste the solution into the formula editor that would be great!&lt;/P&gt;&lt;P&gt;I have attached a sample table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help with this.&lt;/P&gt;&lt;P&gt;Fiona&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:24:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-round-up-or-round-down-dates/m-p/343897#M59340</guid>
      <dc:creator>fionaweston</dc:creator>
      <dc:date>2023-06-10T23:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I round up or round down dates?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-round-up-or-round-down-dates/m-p/343936#M59342</link>
      <description>&lt;P&gt;This script illustrates the approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

date time = 09Oct2020:03:12;

rounded date time = date time - Modulo( date time, In Hours( 1 ) ) + In Hours( 1 );

formatted rounded date time = Format( rounded date time, "m/d/y h:m" );

Show( date time, formatted rounded date time );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The actual formula might be compressed into this expression, assuming that you want a numeric value with the desired Format column attribute:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:date time - Modulo( :date time, In Hours( 1 ) ) + In Hours( 1 )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that rounding down to the nearest hour would simply remove the addition of one hour at the end of the expression.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 19:57:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-round-up-or-round-down-dates/m-p/343936#M59342</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-12-22T19:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I round up or round down dates?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-round-up-or-round-down-dates/m-p/343939#M59343</link>
      <description>&lt;P&gt;Most likely there is cleaner/more efficient way to do this but these should work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rounded opentime:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(In Hours(1) &amp;lt;= Time Of Day(:Opentime) &amp;lt; In Hours(4),
	(:Opentime - Time Of Day(:Opentime)) + In Hours(4),
	:Opentime
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Same idea for rounded closetime:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(In Hours(1) &amp;lt;= Time Of Day(:Closetime) &amp;lt; In Hours(4),
	(:Closetime - Time Of Day(:Closetime)) + In Hours(1),
	:Closetime
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Solution built on the formulas "pre-made" by JMP when you right click on column name on date column for &lt;EM&gt;Date&lt;/EM&gt; and &lt;EM&gt;Time Of Day&lt;/EM&gt;:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1608667237971.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/29075iE7EF0BC2D706755E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1608667237971.png" alt="jthi_1-1608667237971.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 20:03:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-round-up-or-round-down-dates/m-p/343939#M59343</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2020-12-22T20:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I round up or round down dates?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-round-up-or-round-down-dates/m-p/343954#M59346</link>
      <description>&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;P&gt;This works!!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 21:45:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-round-up-or-round-down-dates/m-p/343954#M59346</guid>
      <dc:creator>fionaweston</dc:creator>
      <dc:date>2020-12-22T21:45:29Z</dc:date>
    </item>
  </channel>
</rss>

