<?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 SAS Git function Provides a wrong date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Git-function-Provides-a-wrong-date/m-p/861000#M340110</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using&amp;nbsp;GIT_COMMIT_GET function to get the commit date from Github history log. Unfortunately it is giving me a wrong date (10 years old) and when I look at the documentation, this function returns a time starting from 1970:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Time – the number of seconds since January 1st, 1970&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As the SAS dates start from 01 Jan 1960, this is giving me a wrong date. Any idea how this can be fixed ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;%let GITBranch=Your_Local_Repository;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;data work.x;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;format time1 datetime.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;LENGTH COMMIT_ID AUTHOR_NAME AUTHOR_EMAIL MESSAGE PARENT_IDS TIME $ 1024; &lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;N = GIT_COMMIT_LOG("&amp;amp;GITBranch.");&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;DO I=1 TO N;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_GET(I,"&amp;amp;GITBranch.", "id", COMMIT_ID);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_GET(I,"&amp;amp;GITBranch.", "author", AUTHOR_NAME);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_GET(I,"&amp;amp;GITBranch.", "email", AUTHOR_EMAIL);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_GET(I,"&amp;amp;GITBranch.", "message", MESSAGE);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_GET(I,"&amp;amp;GITBranch.", "parent_ids", PARENT_IDS);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_GET(I,"&amp;amp;GITBranch.", "time", TIME);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;Time1=TIME;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;output;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;END;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_FREE("&amp;amp;GITBranch.");&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;drop N I RC;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Feb 2023 05:58:00 GMT</pubDate>
    <dc:creator>Balli</dc:creator>
    <dc:date>2023-02-27T05:58:00Z</dc:date>
    <item>
      <title>SAS Git function Provides a wrong date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Git-function-Provides-a-wrong-date/m-p/861000#M340110</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using&amp;nbsp;GIT_COMMIT_GET function to get the commit date from Github history log. Unfortunately it is giving me a wrong date (10 years old) and when I look at the documentation, this function returns a time starting from 1970:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Time – the number of seconds since January 1st, 1970&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As the SAS dates start from 01 Jan 1960, this is giving me a wrong date. Any idea how this can be fixed ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;%let GITBranch=Your_Local_Repository;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;data work.x;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;format time1 datetime.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;LENGTH COMMIT_ID AUTHOR_NAME AUTHOR_EMAIL MESSAGE PARENT_IDS TIME $ 1024; &lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;N = GIT_COMMIT_LOG("&amp;amp;GITBranch.");&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;DO I=1 TO N;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_GET(I,"&amp;amp;GITBranch.", "id", COMMIT_ID);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_GET(I,"&amp;amp;GITBranch.", "author", AUTHOR_NAME);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_GET(I,"&amp;amp;GITBranch.", "email", AUTHOR_EMAIL);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_GET(I,"&amp;amp;GITBranch.", "message", MESSAGE);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_GET(I,"&amp;amp;GITBranch.", "parent_ids", PARENT_IDS);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_GET(I,"&amp;amp;GITBranch.", "time", TIME);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;Time1=TIME;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;output;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;END;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;RC = GIT_COMMIT_FREE("&amp;amp;GITBranch.");&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;drop N I RC;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 05:58:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Git-function-Provides-a-wrong-date/m-p/861000#M340110</guid>
      <dc:creator>Balli</dc:creator>
      <dc:date>2023-02-27T05:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Git function Provides a wrong date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Git-function-Provides-a-wrong-date/m-p/861055#M340133</link>
      <description>&lt;P&gt;Hmm, this is not a great solution, but you can manually subtract the number of seconds between 01JAN1970 and 01JAN1960 by using the INTCK function:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data A;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;adjust = INTCK("seconds", '01JAN1960:00.00.00'dt, '01JAN1970:00.00.00'dt);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;put adjust;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The answer is&amp;nbsp;315,619,200 seconds, so you could adjust the TIME variable in your program by that amount.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 11:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Git-function-Provides-a-wrong-date/m-p/861055#M340133</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2023-02-27T11:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Git function Provides a wrong date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Git-function-Provides-a-wrong-date/m-p/861092#M340150</link>
      <description>&lt;P&gt;This is not unique to Git -- it's true for any time that you exchange date/time values with a system that uses epoch (Unix-style) times.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example for how to compensate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;options dlcreatedir;
%let repoPath = %sysfunc(getoption(WORK))/sas-dummy-blog;
libname repo "&amp;amp;repoPath.";
libname repo clear;
 
/* Fetch latest code from GitHub */
data _null_;
 rc = gitfn_clone(
   "https://github.com/sascommunities/sas-dummy-blog.git",
   "&amp;amp;repoPath.");
 put rc=;
run;

data commits (keep=time message);
  length time_char $ 100 time 8 message $ 100 n 8;
  n = gitfn_commit_log("&amp;amp;repoPath.");
  format time datetime20.;

  do i=1 to n;
    rc = gitfn_commit_get(i,"&amp;amp;repoPath.",'message',message);
    rc = gitfn_commit_get(i,"&amp;amp;repoPath.",'time',time_char);
    time = trim(time_char);
    time = time + "01jan1970 0:0:0"dt;
    output;
  end;
run;

title "Commits to this sas-dummy-blog repo";
proc print data=commits;
run;
title;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 27 Feb 2023 13:27:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Git-function-Provides-a-wrong-date/m-p/861092#M340150</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2023-02-27T13:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Git function Provides a wrong date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Git-function-Provides-a-wrong-date/m-p/861656#M340350</link>
      <description>Thanks Chris. It helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 01 Mar 2023 06:12:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Git-function-Provides-a-wrong-date/m-p/861656#M340350</guid>
      <dc:creator>Balli</dc:creator>
      <dc:date>2023-03-01T06:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Git function Provides a wrong date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Git-function-Provides-a-wrong-date/m-p/861657#M340351</link>
      <description>Thanks Rick &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 01 Mar 2023 06:12:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Git-function-Provides-a-wrong-date/m-p/861657#M340351</guid>
      <dc:creator>Balli</dc:creator>
      <dc:date>2023-03-01T06:12:27Z</dc:date>
    </item>
  </channel>
</rss>

