<?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: help in perl script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-perl-script/m-p/2980409#M718279</link>
    <description>Although this explanation is correct, the main point is missing: unix dates are returned in seconds since 01-01-1970, and then converted to an array representing the date parts. In that list, the year is represented in years since 1900, hence year 100 stands for 2000.&lt;BR /&gt;&lt;BR /&gt;Furthermore please do NOT use the syntax as described in the example, but use the `normal' syntax instead:&lt;BR /&gt;&lt;BR /&gt;# Current date (DD-MM-YYYY)&lt;BR /&gt;my @d = localtime time;&lt;BR /&gt;my $date = sprintf "%02d-%02d-%04d", $d[3], $d[2] + 1, $d[5] + 1900;&lt;BR /&gt;&lt;BR /&gt;$TI'DATE is the *OLD* (and depricated) way to write $TI::date. Please do *NOT* use that syntax unless you are trying to write obfuscated scripts.&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn</description>
    <pubDate>Fri, 23 May 2003 06:56:08 GMT</pubDate>
    <dc:creator>H.Merijn Brand (procura</dc:creator>
    <dc:date>2003-05-23T06:56:08Z</dc:date>
    <item>
      <title>help in perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-perl-script/m-p/2980407#M718277</link>
      <description>My PERL script reports dates of 01/20/100.  I used the printf format&lt;BR /&gt;$02d on the year value, but I still get year = 100.&lt;BR /&gt;&lt;BR /&gt;Why am I having this problem?&lt;BR /&gt;</description>
      <pubDate>Fri, 23 May 2003 03:27:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-perl-script/m-p/2980407#M718277</guid>
      <dc:creator>unix_admin</dc:creator>
      <dc:date>2003-05-23T03:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: help in perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-perl-script/m-p/2980408#M718278</link>
      <description>You are getting dates of 01/20/100 because the localtime() return value&lt;BR /&gt;for year is currently 100 for the year 2000.  The printf format for&lt;BR /&gt;decimal conversion (%02d) will prepend leading zeroes, but does not&lt;BR /&gt;truncate to two digits because that would modify the actual value.&lt;BR /&gt;&lt;BR /&gt;'printf' has no truncation capability, even %02s prints the entire&lt;BR /&gt;string, so dealing with two digit dates is a problem that requires&lt;BR /&gt;coding.  Subtracting 100 would yield 00, but for the year 99, that would&lt;BR /&gt;result in a year of -01.&lt;BR /&gt;&lt;BR /&gt;To resolve  your problem, use 4 digit year, just add 1900 to the year.&lt;BR /&gt;This applies to any language using the tm struct returned by functions&lt;BR /&gt;such as localtime()&lt;BR /&gt;&lt;BR /&gt;PERL example&lt;BR /&gt;&lt;BR /&gt;     #Current date (MM/DD/YYYY)&lt;BR /&gt;     $TI'DATE =  join ('/', $TI'MON + 1, $TI'MDY, $TI'YR + 1900);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;radhakrishnan</description>
      <pubDate>Fri, 23 May 2003 03:36:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-perl-script/m-p/2980408#M718278</guid>
      <dc:creator>Radhakrishnan Venkatara</dc:creator>
      <dc:date>2003-05-23T03:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: help in perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-perl-script/m-p/2980409#M718279</link>
      <description>Although this explanation is correct, the main point is missing: unix dates are returned in seconds since 01-01-1970, and then converted to an array representing the date parts. In that list, the year is represented in years since 1900, hence year 100 stands for 2000.&lt;BR /&gt;&lt;BR /&gt;Furthermore please do NOT use the syntax as described in the example, but use the `normal' syntax instead:&lt;BR /&gt;&lt;BR /&gt;# Current date (DD-MM-YYYY)&lt;BR /&gt;my @d = localtime time;&lt;BR /&gt;my $date = sprintf "%02d-%02d-%04d", $d[3], $d[2] + 1, $d[5] + 1900;&lt;BR /&gt;&lt;BR /&gt;$TI'DATE is the *OLD* (and depricated) way to write $TI::date. Please do *NOT* use that syntax unless you are trying to write obfuscated scripts.&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn</description>
      <pubDate>Fri, 23 May 2003 06:56:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-perl-script/m-p/2980409#M718279</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-05-23T06:56:08Z</dc:date>
    </item>
  </channel>
</rss>

