<?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 date format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/760931#M240698</link>
    <description>&lt;P&gt;This is driving me crazy.&amp;nbsp; I need to put the variable into datetime format but I get January 1, 1960 when I do.&amp;nbsp; Here is the code:&lt;/P&gt;&lt;P&gt;data null;&lt;BR /&gt;format Current_Date mmddyy10. Today datetime20.;&lt;BR /&gt;Current_Date = today();&lt;BR /&gt;Today = today();&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;This is the result:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Current_Date&lt;/TD&gt;&lt;TD&gt;Today&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;08/11/2021&lt;/TD&gt;&lt;TD&gt;01Jan1960 6:15:03&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Why am I getting the wrong date with the datetime format?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Aug 2021 14:55:15 GMT</pubDate>
    <dc:creator>BigFluffyTail</dc:creator>
    <dc:date>2021-08-11T14:55:15Z</dc:date>
    <item>
      <title>date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/760931#M240698</link>
      <description>&lt;P&gt;This is driving me crazy.&amp;nbsp; I need to put the variable into datetime format but I get January 1, 1960 when I do.&amp;nbsp; Here is the code:&lt;/P&gt;&lt;P&gt;data null;&lt;BR /&gt;format Current_Date mmddyy10. Today datetime20.;&lt;BR /&gt;Current_Date = today();&lt;BR /&gt;Today = today();&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;This is the result:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Current_Date&lt;/TD&gt;&lt;TD&gt;Today&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;08/11/2021&lt;/TD&gt;&lt;TD&gt;01Jan1960 6:15:03&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Why am I getting the wrong date with the datetime format?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 14:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/760931#M240698</guid>
      <dc:creator>BigFluffyTail</dc:creator>
      <dc:date>2021-08-11T14:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/760933#M240699</link>
      <description>&lt;P&gt;Today() does not return a date-time value, it only returns a date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data null;
    format Current_Date mmddyy10. Today datetime20.;
    Current_Date = today();
    Today = datetime();
    PUTLOG "NOTE: " Current_Date= Today=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 15:02:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/760933#M240699</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-11T15:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/760934#M240700</link>
      <description>&lt;P&gt;Use format date9. for variable TODAY, which is a date, not a date/time&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;use the DATETIME() function and use format datetime20.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 14:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/760934#M240700</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-11T14:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/760939#M240703</link>
      <description>&lt;P&gt;Because you used the wrong format for the value you stored.&amp;nbsp; You stored the number of days since 1960 into the variable and are treating that (small) number as if it was the number of seconds since 1960.&amp;nbsp; Because the number of days&amp;nbsp; is so much smaller than the number of seconds (off by a factor of 24*60*60) it is showing as some time in the morning of the January first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember that SAS datasets have two types of variables: fixed length characters strings and floating point numbers.&amp;nbsp; Formats are just instructions for how to convert values to text.&amp;nbsp; Informats are instructions for how to convert text into values.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 15:09:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/760939#M240703</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-11T15:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/763100#M241654</link>
      <description>&lt;P&gt;I have date is the forma such as : 8/21/2021,&amp;nbsp; customer need the format as : 2021/08/21, how do I ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Aug 2021 03:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/763100#M241654</guid>
      <dc:creator>JHE</dc:creator>
      <dc:date>2021-08-22T03:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/763101#M241655</link>
      <description>&lt;P&gt;I need convert date display:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have date for example: 8/21/2021, customer need display this format as 2021/08/21.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I could do?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Aug 2021 03:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-format/m-p/763101#M241655</guid>
      <dc:creator>JHE</dc:creator>
      <dc:date>2021-08-22T03:35:23Z</dc:date>
    </item>
  </channel>
</rss>

