<?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: Converting TimeStamp in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229720#M894289</link>
    <description>&lt;BR /&gt;Clay, right. Perl is proabbly the ultimate solution.&lt;BR /&gt;&lt;BR /&gt;btw... 'shift' byy default operates on ARGV so the main loop in you example can be simplified from:&lt;BR /&gt;&lt;BR /&gt;while ($#ARGV &amp;gt;= 0)&lt;BR /&gt;{&lt;BR /&gt;do_1_timestamp($ARGV[0]);&lt;BR /&gt;shift;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;to (a less readbale perhaps):&lt;BR /&gt;&lt;BR /&gt;do_1_timestamp($ts) while ($ts=shift);&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;perl -e 'while ($#ARGV&amp;gt;=0) { print $ARGV[0],"\n"; shift }' aap noot mies&lt;BR /&gt;&lt;BR /&gt;vs&lt;BR /&gt;&lt;BR /&gt;perl -e 'while ($_=shift) { print $_,"\n"}' aap noot mies&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 25 Mar 2004 11:06:48 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2004-03-25T11:06:48Z</dc:date>
    <item>
      <title>Converting TimeStamp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229714#M894283</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Is there a way to covert a unix timestamp to '%Y%m%d %H%M'&lt;BR /&gt;for eg 1080145459 must result to "20040324182419" or "2004/03/24/18:24:19"&lt;BR /&gt;&lt;BR /&gt;I have tried the following and works well, but cannot get the date format that I require. &lt;BR /&gt;&lt;BR /&gt;echo "od1080145459=Y|adb | tr -d '\011' and the  result is&lt;BR /&gt; 2004 Mar 24 18:24:19&lt;BR /&gt;&lt;BR /&gt;Many Thanks&lt;BR /&gt;Chris &lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Thu, 25 Mar 2004 09:34:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229714#M894283</guid>
      <dc:creator>Chris Frangandonis</dc:creator>
      <dc:date>2004-03-25T09:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Converting TimeStamp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229715#M894284</link>
      <description>well its ugly, but you could create an awk script called date.awk with the following in it:&lt;BR /&gt;&lt;BR /&gt;BEGIN{dadate["Jan"]="01";dadate["Feb"]="02"; dadate["Mar"]="03";dadate["Apr"]="0&lt;BR /&gt;4";dadate["May"]="05";dadate["Jun"]="06";dadate["Jul"]="07";dadate["Aug"]="08";&lt;BR /&gt;dadate["Sep"]="09";dadate["Oct"]="10";dadate["Nov"]="11";dadate["Dec"]="12";}&lt;BR /&gt;{print $1"/"dadate[$2]"/"$3"/"$4 }&lt;BR /&gt;&lt;BR /&gt;Then pipe what you have so far (the 2004 Mar 24 18:24:19 ) through the script using | awk -f date.awk&lt;BR /&gt;&lt;BR /&gt;That would do it.&lt;BR /&gt;&lt;BR /&gt;Oz&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Mar 2004 09:49:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229715#M894284</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2004-03-25T09:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Converting TimeStamp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229716#M894285</link>
      <description>Chris,&lt;BR /&gt;&lt;BR /&gt;interesting adb use. It must have something to do with localization.&lt;BR /&gt;&lt;BR /&gt;Anyway, I wrote a little C program. May need some adjustment for your output format.&lt;BR /&gt;&lt;BR /&gt;See attachment.&lt;BR /&gt;&lt;BR /&gt;JP.</description>
      <pubDate>Thu, 25 Mar 2004 09:58:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229716#M894285</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-03-25T09:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Converting TimeStamp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229717#M894286</link>
      <description>That adb command does nor work for me.&lt;BR /&gt;&lt;BR /&gt;If the remaining challenge is translate month names to number, might I suggest the awk index function? for example:&lt;BR /&gt;&lt;BR /&gt;echo "2004 Mar 24 18:24:19" | awk '{m=index("xxJanFebMarAprMayJunJulSepOctNovDec",$2)/3; print m"/"$3"/"$1}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Mar 2004 10:50:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229717#M894286</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-03-25T10:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Converting TimeStamp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229718#M894287</link>
      <description>Probably the cleanest way to do this is Perl.&lt;BR /&gt;&lt;BR /&gt;timestamp.pl&lt;BR /&gt;---------------------------------&lt;BR /&gt;#!/usr/bin/perl -w&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;&lt;BR /&gt;sub do_1_timestamp&lt;BR /&gt;{&lt;BR /&gt;  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($_[0]);&lt;BR /&gt;  printf("%04d%02d%02d%02d%02d\n",$year + 1900,$mon + 1,$mday,$hour,$min);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;while ($#ARGV &amp;gt;= 0)&lt;BR /&gt;  {&lt;BR /&gt;     do_1_timestamp($ARGV[0]);&lt;BR /&gt;     shift;&lt;BR /&gt;  }&lt;BR /&gt;------------------------------------------&lt;BR /&gt;TS=1080145459&lt;BR /&gt;TM=$(timestamp.pl ${TS})&lt;BR /&gt;echo "Timestamp for ${TS} -&amp;gt; ${TM}"&lt;BR /&gt;&lt;BR /&gt;The above script uses the localtime() function which takes into account timezone and daylight saving time. You might choose to use the gmtime() function which report UTC time. I intentionally grabbed all the values returned from localtime() so that you can modify the printf to as complicated an output as you like. Note: $year is number of years since 1900 and $mon ranges from 0 to 11 -- just like the C counterparts.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Mar 2004 10:55:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229718#M894287</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-03-25T10:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Converting TimeStamp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229719#M894288</link>
      <description>perl -e '$epochtime = 1058850045; print scalar localtime($epochtime);'&lt;BR /&gt;Tue Jul 22 07:00:45 2003&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Mar 2004 11:06:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229719#M894288</guid>
      <dc:creator>Nicolas Dumeige</dc:creator>
      <dc:date>2004-03-25T11:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Converting TimeStamp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229720#M894289</link>
      <description>&lt;BR /&gt;Clay, right. Perl is proabbly the ultimate solution.&lt;BR /&gt;&lt;BR /&gt;btw... 'shift' byy default operates on ARGV so the main loop in you example can be simplified from:&lt;BR /&gt;&lt;BR /&gt;while ($#ARGV &amp;gt;= 0)&lt;BR /&gt;{&lt;BR /&gt;do_1_timestamp($ARGV[0]);&lt;BR /&gt;shift;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;to (a less readbale perhaps):&lt;BR /&gt;&lt;BR /&gt;do_1_timestamp($ts) while ($ts=shift);&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;perl -e 'while ($#ARGV&amp;gt;=0) { print $ARGV[0],"\n"; shift }' aap noot mies&lt;BR /&gt;&lt;BR /&gt;vs&lt;BR /&gt;&lt;BR /&gt;perl -e 'while ($_=shift) { print $_,"\n"}' aap noot mies&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Mar 2004 11:06:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/converting-timestamp/m-p/3229720#M894289</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-03-25T11:06:48Z</dc:date>
    </item>
  </channel>
</rss>

