<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Date &amp;amp; Time</title><link>https://community.appian.com/discussions/f/general/29953/date-time</link><description>Hello, 
 
 I need to pass the yesterday&amp;#39;s date and a specific time to a variable of dateTime type. Basically today I want to get all the data which is saved in database yesterday. How to achieve this? 
 
 Thank you.</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Date &amp; Time</title><link>https://community.appian.com/thread/123309?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2023 18:33:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9cc19736-ac58-4da3-aa49-8f6885470a8c</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Below the code snippet in the language whitespace:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Could anyone&amp;nbsp;create an Appian plugin to run whitespace code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date &amp; Time</title><link>https://community.appian.com/thread/123308?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2023 18:25:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cd6836c4-ebef-464a-9c87-6e3b58afcce3</guid><dc:creator>eusebiof9911</dc:creator><description>&lt;p&gt;To get yesterday&amp;rsquo;s date in Python, you can use the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;datetime&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;module and the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;timedelta()&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;function. Here&amp;rsquo;s an example code snippet that shows how to get yesterday&amp;rsquo;s date in the format&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;MMDDYY&lt;/code&gt;:&lt;/p&gt;
&lt;div class="code-header"&gt;&lt;span class="code-lang"&gt;Python&lt;/span&gt;
&lt;div class="code-actions"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre&gt;&lt;code class="language-python"&gt;&lt;span class="hljs-keyword"&gt;&lt;/span&gt;&lt;pre class="ui-code" data-mode="text"&gt;from datetime import date, timedelta

yesterday = date.today() - timedelta(days=1)
yesterday_date = yesterday.strftime(&amp;#39;%m%d%y&amp;#39;)&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div class="code-footer"&gt;&lt;/div&gt;
&lt;p&gt;In this code snippet,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;date.today()&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;returns today&amp;rsquo;s date, and&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;timedelta(days=1)&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;subtracts one day from it, giving us yesterday&amp;rsquo;s date. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;strftime()&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;function is then used to format the date as&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;MMDDYY&lt;/code&gt;. &lt;span style="background-color:#ffffff;color:#ffffff;"&gt;&lt;a style="background-color:#ffffff;color:#ffffff;" href="https://seterra.io"&gt;seterra&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;To get a specific time for yesterday&amp;rsquo;s date, you can use the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;datetime&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;module and the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;combine()&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;function. Here&amp;rsquo;s an example code snippet that shows how to combine yesterday&amp;rsquo;s date with a specific time:&lt;/p&gt;
&lt;div class="code-header"&gt;&lt;span class="code-lang"&gt;Python&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;&lt;br /&gt;&lt;code class="language-python"&gt;&lt;span class="hljs-keyword"&gt;&lt;/span&gt;&lt;pre class="ui-code" data-mode="text"&gt;from datetime import datetime, timedelta

yesterday = datetime.now() - timedelta(days=1)
specific_time = datetime.strptime(&amp;#39;12:30:00&amp;#39;, &amp;#39;%H:%M:%S&amp;#39;).time()
yesterday_specific_time = datetime.combine(yesterday.date(), specific_time)&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div class="code-footer"&gt;&lt;/div&gt;
&lt;p&gt;In this code snippet,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;datetime.now()&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;returns the current date and time, and&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;timedelta(days=1)&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;subtracts one day from it, giving us yesterday&amp;rsquo;s date and time. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;strptime()&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;function is then used to parse the specific time string&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;12:30:00&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;into a&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;time&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;object. Finally, the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;combine()&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;function is used to combine yesterday&amp;rsquo;s date with the specific time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date &amp; Time</title><link>https://community.appian.com/thread/118936?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2023 06:00:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a976434e-9480-4c14-9251-308c1d714f24</guid><dc:creator>Mathieu Drouin</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I provided answers to 2 previous threads of yours which show how to create filters and calculate datetimes.&lt;/p&gt;
&lt;p&gt;Filter for previous month: &lt;a href="https://community.appian.com/discussions/f/general/29915/to-find-if-a-given-date-is-from-previous-month"&gt;community.appian.com/.../to-find-if-a-given-date-is-from-previous-month&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Filter for last 45 days: &lt;a href="https://community.appian.com/discussions/f/user-interface/29941/how-to-generate-report-based-on-the-user-filters"&gt;community.appian.com/.../how-to-generate-report-based-on-the-user-filters&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Would be very similar to the 45 day answer, except you subtract 1 day instead of 45 and pass 00:00 in the hours/minutes/seconds fields of the startDateTime and 23:59:59 in the endDateTime.&lt;/p&gt;
&lt;p&gt;If an answer helps you, please mark it as verified so that others can find it later.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>