Convert Unix timestamp into human-readable format on AIX

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite












I need to convert unix timestamp (number of seconds since 1970, e.g. 1381260225 is Tue Oct 8 19:23:45 GMT 2013) into a standard human-readable format.



I could get some answers by googling but those were not a suitable solution for me because I don't use Linux, I use an AIX 6.1 machine with ksh88. AIX does not have GNU utilities.










share|improve this question



















  • 1




    How amenable are you to a C-program?
    – ChuckCottrill
    Oct 15 '13 at 21:16






  • 1




    @ChuckCottrill: The AIX machine which I use is not having C compiler.
    – ramp
    Oct 16 '13 at 9:40






  • 1




    You say you don't have the GNU utilities, what does which perl return on the server? Also, give that relies on your path and we don't know what that is, how about ls -l /usr/bin/perl.
    – EightBitTony
    Apr 9 '14 at 7:58















up vote
4
down vote

favorite












I need to convert unix timestamp (number of seconds since 1970, e.g. 1381260225 is Tue Oct 8 19:23:45 GMT 2013) into a standard human-readable format.



I could get some answers by googling but those were not a suitable solution for me because I don't use Linux, I use an AIX 6.1 machine with ksh88. AIX does not have GNU utilities.










share|improve this question



















  • 1




    How amenable are you to a C-program?
    – ChuckCottrill
    Oct 15 '13 at 21:16






  • 1




    @ChuckCottrill: The AIX machine which I use is not having C compiler.
    – ramp
    Oct 16 '13 at 9:40






  • 1




    You say you don't have the GNU utilities, what does which perl return on the server? Also, give that relies on your path and we don't know what that is, how about ls -l /usr/bin/perl.
    – EightBitTony
    Apr 9 '14 at 7:58













up vote
4
down vote

favorite









up vote
4
down vote

favorite











I need to convert unix timestamp (number of seconds since 1970, e.g. 1381260225 is Tue Oct 8 19:23:45 GMT 2013) into a standard human-readable format.



I could get some answers by googling but those were not a suitable solution for me because I don't use Linux, I use an AIX 6.1 machine with ksh88. AIX does not have GNU utilities.










share|improve this question















I need to convert unix timestamp (number of seconds since 1970, e.g. 1381260225 is Tue Oct 8 19:23:45 GMT 2013) into a standard human-readable format.



I could get some answers by googling but those were not a suitable solution for me because I don't use Linux, I use an AIX 6.1 machine with ksh88. AIX does not have GNU utilities.







ksh date aix timestamps






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 16 '13 at 9:11









Gilles

512k12010151546




512k12010151546










asked Oct 15 '13 at 19:08









ramp

3061513




3061513







  • 1




    How amenable are you to a C-program?
    – ChuckCottrill
    Oct 15 '13 at 21:16






  • 1




    @ChuckCottrill: The AIX machine which I use is not having C compiler.
    – ramp
    Oct 16 '13 at 9:40






  • 1




    You say you don't have the GNU utilities, what does which perl return on the server? Also, give that relies on your path and we don't know what that is, how about ls -l /usr/bin/perl.
    – EightBitTony
    Apr 9 '14 at 7:58













  • 1




    How amenable are you to a C-program?
    – ChuckCottrill
    Oct 15 '13 at 21:16






  • 1




    @ChuckCottrill: The AIX machine which I use is not having C compiler.
    – ramp
    Oct 16 '13 at 9:40






  • 1




    You say you don't have the GNU utilities, what does which perl return on the server? Also, give that relies on your path and we don't know what that is, how about ls -l /usr/bin/perl.
    – EightBitTony
    Apr 9 '14 at 7:58








1




1




How amenable are you to a C-program?
– ChuckCottrill
Oct 15 '13 at 21:16




How amenable are you to a C-program?
– ChuckCottrill
Oct 15 '13 at 21:16




1




1




@ChuckCottrill: The AIX machine which I use is not having C compiler.
– ramp
Oct 16 '13 at 9:40




@ChuckCottrill: The AIX machine which I use is not having C compiler.
– ramp
Oct 16 '13 at 9:40




1




1




You say you don't have the GNU utilities, what does which perl return on the server? Also, give that relies on your path and we don't know what that is, how about ls -l /usr/bin/perl.
– EightBitTony
Apr 9 '14 at 7:58





You say you don't have the GNU utilities, what does which perl return on the server? Also, give that relies on your path and we don't know what that is, how about ls -l /usr/bin/perl.
– EightBitTony
Apr 9 '14 at 7:58











6 Answers
6






active

oldest

votes

















up vote
5
down vote













If you were on Linux, you could simply use:



date -d @1381260225


Or you could use gawk:



echo "1381260225" | gawk 'print strftime("%c",$1)'


Or Python:



python -c "import datetime; print datetime.datetime.fromtimestamp(1381865497)"


Or Perl:



perl -e 'print(scalar(localtime(1381865497)), "n";'


However none of these solutions are available on a stock AIX installation.
All of these tools (GNU coreutils, GNU awk, Perl, Python) are available as separate packages as part of the AIX toolbox for Linux applications.






share|improve this answer


















  • 1




    date -d is a GNU-ism. The equivalent for OpenBSD would be date -r 1381260225. And I'm not even sure that is standard, because Solaris doesn't even have an equivalent of -d or -r. Solaris only seems to be able to set or display the current time.
    – kurtm
    Oct 15 '13 at 19:41






  • 1




    @kurtm AIX date does not seem to have -r either, see here. I think RahulPatil's awk solution will be the most portable.
    – terdon♦
    Oct 15 '13 at 19:44










  • @terdon I concur that the awk solution is probably the most portable. I figured AIX wouldn't support it either, but don't have any AIX machines I can check.
    – kurtm
    Oct 15 '13 at 19:45






  • 2




    @kurtm You can look up AIX man pages online. None of these methods work on AIX, not even the awk method as awk doesn't have strftime (it's a GNU extension).
    – Gilles
    Oct 15 '13 at 21:48






  • 1




    For info: AIX comes with perl, I'm pretty sure it's installed by default. You don't need to use the AIX toolbox for Linux to install it, it's in the base image.
    – EightBitTony
    Apr 9 '14 at 7:55


















up vote
3
down vote













You can probably fall back to Perl:



perl -MPOSIX=strftime -e 'print strftime("%Y-%m-%d %T", localtime($ARGV[0])), "n"' 1381260225




2013-10-08 15:23:45





share|improve this answer
















  • 1




    +1 but if I'm not mistaken, AIX does not have Perl by default and I don't know whether POSIX::strftime will be installed even if it does. Can these be installed without root access on AIX?
    – terdon♦
    Oct 15 '13 at 19:28











  • @terdon is python default install in AIX ?
    – Rahul Patil
    Oct 15 '13 at 19:29










  • @RahulPatil I doubt it (but don't really know). However, both perl and python can be downloaded from here.
    – terdon♦
    Oct 15 '13 at 19:32










  • @RahulPatil If something doesn't have perl by default, it's not likely to have python by default.
    – kurtm
    Oct 15 '13 at 19:38










  • @RahulPatil&tredon: The machine I use does not have either Perl or Python at the same time I do not have admin access to the same.
    – ramp
    Oct 16 '13 at 9:29

















up vote
1
down vote













# echo 1381260225 | python -c 'import sys; import time; print time.ctime( float( sys.stdin.read() ) )'
Wed Oct 9 02:23:45 2013





share|improve this answer
















  • 1




    A Python answer has already been given. AIX does not have Python installed by default.
    – Gilles
    Oct 16 '13 at 9:12










  • My one is better. Compare number of letters.
    – polar bear on the white snow
    Oct 16 '13 at 12:33

















up vote
1
down vote













A bit more perlish:



echo 1397028688|perl -l12ne 'print scalar localtime $_'
Wed Apr 9 09:31:28 2014





share|improve this answer



























    up vote
    0
    down vote













    AIX has ksh93, so:




    • local time (here mainland Britain):



      $ ksh93 -c 'printf "%(%Y-%m-%d %T %z)Tn" "#$1"' ksh93 1381260225
      2013-10-08 20:23:45 +0100



    • GMT/UTC



      $ TZ=GMT0 ksh93 -c 'printf "%(%Y-%m-%d %T %Z)Tn" "#$1"' ksh93 1381260225
      2013-10-08 19:23:45 GMT






    share|improve this answer



























      up vote
      -4
      down vote













      what about something like this ??



      echo "`date +"%y%m%d%H%M%S"`"





      share|improve this answer


















      • 1




        You meant echo "$(date +"%y%m%d%H%M%S")" but it only outputs the Unix timestamp of the current date. The question was about converting a specified Unix timestamp to a human-readable date string.
        – telcoM
        Sep 19 at 9:11










      • You're using backticks so the double quotes don't nest. Consider using the more modern style $( ... ) instead.
        – roaima
        Sep 19 at 11:54










      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f96189%2fconvert-unix-timestamp-into-human-readable-format-on-aix%23new-answer', 'question_page');

      );

      Post as a guest






























      6 Answers
      6






      active

      oldest

      votes








      6 Answers
      6






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      5
      down vote













      If you were on Linux, you could simply use:



      date -d @1381260225


      Or you could use gawk:



      echo "1381260225" | gawk 'print strftime("%c",$1)'


      Or Python:



      python -c "import datetime; print datetime.datetime.fromtimestamp(1381865497)"


      Or Perl:



      perl -e 'print(scalar(localtime(1381865497)), "n";'


      However none of these solutions are available on a stock AIX installation.
      All of these tools (GNU coreutils, GNU awk, Perl, Python) are available as separate packages as part of the AIX toolbox for Linux applications.






      share|improve this answer


















      • 1




        date -d is a GNU-ism. The equivalent for OpenBSD would be date -r 1381260225. And I'm not even sure that is standard, because Solaris doesn't even have an equivalent of -d or -r. Solaris only seems to be able to set or display the current time.
        – kurtm
        Oct 15 '13 at 19:41






      • 1




        @kurtm AIX date does not seem to have -r either, see here. I think RahulPatil's awk solution will be the most portable.
        – terdon♦
        Oct 15 '13 at 19:44










      • @terdon I concur that the awk solution is probably the most portable. I figured AIX wouldn't support it either, but don't have any AIX machines I can check.
        – kurtm
        Oct 15 '13 at 19:45






      • 2




        @kurtm You can look up AIX man pages online. None of these methods work on AIX, not even the awk method as awk doesn't have strftime (it's a GNU extension).
        – Gilles
        Oct 15 '13 at 21:48






      • 1




        For info: AIX comes with perl, I'm pretty sure it's installed by default. You don't need to use the AIX toolbox for Linux to install it, it's in the base image.
        – EightBitTony
        Apr 9 '14 at 7:55















      up vote
      5
      down vote













      If you were on Linux, you could simply use:



      date -d @1381260225


      Or you could use gawk:



      echo "1381260225" | gawk 'print strftime("%c",$1)'


      Or Python:



      python -c "import datetime; print datetime.datetime.fromtimestamp(1381865497)"


      Or Perl:



      perl -e 'print(scalar(localtime(1381865497)), "n";'


      However none of these solutions are available on a stock AIX installation.
      All of these tools (GNU coreutils, GNU awk, Perl, Python) are available as separate packages as part of the AIX toolbox for Linux applications.






      share|improve this answer


















      • 1




        date -d is a GNU-ism. The equivalent for OpenBSD would be date -r 1381260225. And I'm not even sure that is standard, because Solaris doesn't even have an equivalent of -d or -r. Solaris only seems to be able to set or display the current time.
        – kurtm
        Oct 15 '13 at 19:41






      • 1




        @kurtm AIX date does not seem to have -r either, see here. I think RahulPatil's awk solution will be the most portable.
        – terdon♦
        Oct 15 '13 at 19:44










      • @terdon I concur that the awk solution is probably the most portable. I figured AIX wouldn't support it either, but don't have any AIX machines I can check.
        – kurtm
        Oct 15 '13 at 19:45






      • 2




        @kurtm You can look up AIX man pages online. None of these methods work on AIX, not even the awk method as awk doesn't have strftime (it's a GNU extension).
        – Gilles
        Oct 15 '13 at 21:48






      • 1




        For info: AIX comes with perl, I'm pretty sure it's installed by default. You don't need to use the AIX toolbox for Linux to install it, it's in the base image.
        – EightBitTony
        Apr 9 '14 at 7:55













      up vote
      5
      down vote










      up vote
      5
      down vote









      If you were on Linux, you could simply use:



      date -d @1381260225


      Or you could use gawk:



      echo "1381260225" | gawk 'print strftime("%c",$1)'


      Or Python:



      python -c "import datetime; print datetime.datetime.fromtimestamp(1381865497)"


      Or Perl:



      perl -e 'print(scalar(localtime(1381865497)), "n";'


      However none of these solutions are available on a stock AIX installation.
      All of these tools (GNU coreutils, GNU awk, Perl, Python) are available as separate packages as part of the AIX toolbox for Linux applications.






      share|improve this answer














      If you were on Linux, you could simply use:



      date -d @1381260225


      Or you could use gawk:



      echo "1381260225" | gawk 'print strftime("%c",$1)'


      Or Python:



      python -c "import datetime; print datetime.datetime.fromtimestamp(1381865497)"


      Or Perl:



      perl -e 'print(scalar(localtime(1381865497)), "n";'


      However none of these solutions are available on a stock AIX installation.
      All of these tools (GNU coreutils, GNU awk, Perl, Python) are available as separate packages as part of the AIX toolbox for Linux applications.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Sep 19 at 9:19









      Stéphane Chazelas

      287k53528867




      287k53528867










      answered Oct 15 '13 at 19:18









      Rahul Patil

      14.3k185882




      14.3k185882







      • 1




        date -d is a GNU-ism. The equivalent for OpenBSD would be date -r 1381260225. And I'm not even sure that is standard, because Solaris doesn't even have an equivalent of -d or -r. Solaris only seems to be able to set or display the current time.
        – kurtm
        Oct 15 '13 at 19:41






      • 1




        @kurtm AIX date does not seem to have -r either, see here. I think RahulPatil's awk solution will be the most portable.
        – terdon♦
        Oct 15 '13 at 19:44










      • @terdon I concur that the awk solution is probably the most portable. I figured AIX wouldn't support it either, but don't have any AIX machines I can check.
        – kurtm
        Oct 15 '13 at 19:45






      • 2




        @kurtm You can look up AIX man pages online. None of these methods work on AIX, not even the awk method as awk doesn't have strftime (it's a GNU extension).
        – Gilles
        Oct 15 '13 at 21:48






      • 1




        For info: AIX comes with perl, I'm pretty sure it's installed by default. You don't need to use the AIX toolbox for Linux to install it, it's in the base image.
        – EightBitTony
        Apr 9 '14 at 7:55













      • 1




        date -d is a GNU-ism. The equivalent for OpenBSD would be date -r 1381260225. And I'm not even sure that is standard, because Solaris doesn't even have an equivalent of -d or -r. Solaris only seems to be able to set or display the current time.
        – kurtm
        Oct 15 '13 at 19:41






      • 1




        @kurtm AIX date does not seem to have -r either, see here. I think RahulPatil's awk solution will be the most portable.
        – terdon♦
        Oct 15 '13 at 19:44










      • @terdon I concur that the awk solution is probably the most portable. I figured AIX wouldn't support it either, but don't have any AIX machines I can check.
        – kurtm
        Oct 15 '13 at 19:45






      • 2




        @kurtm You can look up AIX man pages online. None of these methods work on AIX, not even the awk method as awk doesn't have strftime (it's a GNU extension).
        – Gilles
        Oct 15 '13 at 21:48






      • 1




        For info: AIX comes with perl, I'm pretty sure it's installed by default. You don't need to use the AIX toolbox for Linux to install it, it's in the base image.
        – EightBitTony
        Apr 9 '14 at 7:55








      1




      1




      date -d is a GNU-ism. The equivalent for OpenBSD would be date -r 1381260225. And I'm not even sure that is standard, because Solaris doesn't even have an equivalent of -d or -r. Solaris only seems to be able to set or display the current time.
      – kurtm
      Oct 15 '13 at 19:41




      date -d is a GNU-ism. The equivalent for OpenBSD would be date -r 1381260225. And I'm not even sure that is standard, because Solaris doesn't even have an equivalent of -d or -r. Solaris only seems to be able to set or display the current time.
      – kurtm
      Oct 15 '13 at 19:41




      1




      1




      @kurtm AIX date does not seem to have -r either, see here. I think RahulPatil's awk solution will be the most portable.
      – terdon♦
      Oct 15 '13 at 19:44




      @kurtm AIX date does not seem to have -r either, see here. I think RahulPatil's awk solution will be the most portable.
      – terdon♦
      Oct 15 '13 at 19:44












      @terdon I concur that the awk solution is probably the most portable. I figured AIX wouldn't support it either, but don't have any AIX machines I can check.
      – kurtm
      Oct 15 '13 at 19:45




      @terdon I concur that the awk solution is probably the most portable. I figured AIX wouldn't support it either, but don't have any AIX machines I can check.
      – kurtm
      Oct 15 '13 at 19:45




      2




      2




      @kurtm You can look up AIX man pages online. None of these methods work on AIX, not even the awk method as awk doesn't have strftime (it's a GNU extension).
      – Gilles
      Oct 15 '13 at 21:48




      @kurtm You can look up AIX man pages online. None of these methods work on AIX, not even the awk method as awk doesn't have strftime (it's a GNU extension).
      – Gilles
      Oct 15 '13 at 21:48




      1




      1




      For info: AIX comes with perl, I'm pretty sure it's installed by default. You don't need to use the AIX toolbox for Linux to install it, it's in the base image.
      – EightBitTony
      Apr 9 '14 at 7:55





      For info: AIX comes with perl, I'm pretty sure it's installed by default. You don't need to use the AIX toolbox for Linux to install it, it's in the base image.
      – EightBitTony
      Apr 9 '14 at 7:55













      up vote
      3
      down vote













      You can probably fall back to Perl:



      perl -MPOSIX=strftime -e 'print strftime("%Y-%m-%d %T", localtime($ARGV[0])), "n"' 1381260225




      2013-10-08 15:23:45





      share|improve this answer
















      • 1




        +1 but if I'm not mistaken, AIX does not have Perl by default and I don't know whether POSIX::strftime will be installed even if it does. Can these be installed without root access on AIX?
        – terdon♦
        Oct 15 '13 at 19:28











      • @terdon is python default install in AIX ?
        – Rahul Patil
        Oct 15 '13 at 19:29










      • @RahulPatil I doubt it (but don't really know). However, both perl and python can be downloaded from here.
        – terdon♦
        Oct 15 '13 at 19:32










      • @RahulPatil If something doesn't have perl by default, it's not likely to have python by default.
        – kurtm
        Oct 15 '13 at 19:38










      • @RahulPatil&tredon: The machine I use does not have either Perl or Python at the same time I do not have admin access to the same.
        – ramp
        Oct 16 '13 at 9:29














      up vote
      3
      down vote













      You can probably fall back to Perl:



      perl -MPOSIX=strftime -e 'print strftime("%Y-%m-%d %T", localtime($ARGV[0])), "n"' 1381260225




      2013-10-08 15:23:45





      share|improve this answer
















      • 1




        +1 but if I'm not mistaken, AIX does not have Perl by default and I don't know whether POSIX::strftime will be installed even if it does. Can these be installed without root access on AIX?
        – terdon♦
        Oct 15 '13 at 19:28











      • @terdon is python default install in AIX ?
        – Rahul Patil
        Oct 15 '13 at 19:29










      • @RahulPatil I doubt it (but don't really know). However, both perl and python can be downloaded from here.
        – terdon♦
        Oct 15 '13 at 19:32










      • @RahulPatil If something doesn't have perl by default, it's not likely to have python by default.
        – kurtm
        Oct 15 '13 at 19:38










      • @RahulPatil&tredon: The machine I use does not have either Perl or Python at the same time I do not have admin access to the same.
        – ramp
        Oct 16 '13 at 9:29












      up vote
      3
      down vote










      up vote
      3
      down vote









      You can probably fall back to Perl:



      perl -MPOSIX=strftime -e 'print strftime("%Y-%m-%d %T", localtime($ARGV[0])), "n"' 1381260225




      2013-10-08 15:23:45





      share|improve this answer












      You can probably fall back to Perl:



      perl -MPOSIX=strftime -e 'print strftime("%Y-%m-%d %T", localtime($ARGV[0])), "n"' 1381260225




      2013-10-08 15:23:45






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Oct 15 '13 at 19:22









      glenn jackman

      48.2k365105




      48.2k365105







      • 1




        +1 but if I'm not mistaken, AIX does not have Perl by default and I don't know whether POSIX::strftime will be installed even if it does. Can these be installed without root access on AIX?
        – terdon♦
        Oct 15 '13 at 19:28











      • @terdon is python default install in AIX ?
        – Rahul Patil
        Oct 15 '13 at 19:29










      • @RahulPatil I doubt it (but don't really know). However, both perl and python can be downloaded from here.
        – terdon♦
        Oct 15 '13 at 19:32










      • @RahulPatil If something doesn't have perl by default, it's not likely to have python by default.
        – kurtm
        Oct 15 '13 at 19:38










      • @RahulPatil&tredon: The machine I use does not have either Perl or Python at the same time I do not have admin access to the same.
        – ramp
        Oct 16 '13 at 9:29












      • 1




        +1 but if I'm not mistaken, AIX does not have Perl by default and I don't know whether POSIX::strftime will be installed even if it does. Can these be installed without root access on AIX?
        – terdon♦
        Oct 15 '13 at 19:28











      • @terdon is python default install in AIX ?
        – Rahul Patil
        Oct 15 '13 at 19:29










      • @RahulPatil I doubt it (but don't really know). However, both perl and python can be downloaded from here.
        – terdon♦
        Oct 15 '13 at 19:32










      • @RahulPatil If something doesn't have perl by default, it's not likely to have python by default.
        – kurtm
        Oct 15 '13 at 19:38










      • @RahulPatil&tredon: The machine I use does not have either Perl or Python at the same time I do not have admin access to the same.
        – ramp
        Oct 16 '13 at 9:29







      1




      1




      +1 but if I'm not mistaken, AIX does not have Perl by default and I don't know whether POSIX::strftime will be installed even if it does. Can these be installed without root access on AIX?
      – terdon♦
      Oct 15 '13 at 19:28





      +1 but if I'm not mistaken, AIX does not have Perl by default and I don't know whether POSIX::strftime will be installed even if it does. Can these be installed without root access on AIX?
      – terdon♦
      Oct 15 '13 at 19:28













      @terdon is python default install in AIX ?
      – Rahul Patil
      Oct 15 '13 at 19:29




      @terdon is python default install in AIX ?
      – Rahul Patil
      Oct 15 '13 at 19:29












      @RahulPatil I doubt it (but don't really know). However, both perl and python can be downloaded from here.
      – terdon♦
      Oct 15 '13 at 19:32




      @RahulPatil I doubt it (but don't really know). However, both perl and python can be downloaded from here.
      – terdon♦
      Oct 15 '13 at 19:32












      @RahulPatil If something doesn't have perl by default, it's not likely to have python by default.
      – kurtm
      Oct 15 '13 at 19:38




      @RahulPatil If something doesn't have perl by default, it's not likely to have python by default.
      – kurtm
      Oct 15 '13 at 19:38












      @RahulPatil&tredon: The machine I use does not have either Perl or Python at the same time I do not have admin access to the same.
      – ramp
      Oct 16 '13 at 9:29




      @RahulPatil&tredon: The machine I use does not have either Perl or Python at the same time I do not have admin access to the same.
      – ramp
      Oct 16 '13 at 9:29










      up vote
      1
      down vote













      # echo 1381260225 | python -c 'import sys; import time; print time.ctime( float( sys.stdin.read() ) )'
      Wed Oct 9 02:23:45 2013





      share|improve this answer
















      • 1




        A Python answer has already been given. AIX does not have Python installed by default.
        – Gilles
        Oct 16 '13 at 9:12










      • My one is better. Compare number of letters.
        – polar bear on the white snow
        Oct 16 '13 at 12:33














      up vote
      1
      down vote













      # echo 1381260225 | python -c 'import sys; import time; print time.ctime( float( sys.stdin.read() ) )'
      Wed Oct 9 02:23:45 2013





      share|improve this answer
















      • 1




        A Python answer has already been given. AIX does not have Python installed by default.
        – Gilles
        Oct 16 '13 at 9:12










      • My one is better. Compare number of letters.
        – polar bear on the white snow
        Oct 16 '13 at 12:33












      up vote
      1
      down vote










      up vote
      1
      down vote









      # echo 1381260225 | python -c 'import sys; import time; print time.ctime( float( sys.stdin.read() ) )'
      Wed Oct 9 02:23:45 2013





      share|improve this answer












      # echo 1381260225 | python -c 'import sys; import time; print time.ctime( float( sys.stdin.read() ) )'
      Wed Oct 9 02:23:45 2013






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Oct 16 '13 at 5:26









      polar bear on the white snow

      1213




      1213







      • 1




        A Python answer has already been given. AIX does not have Python installed by default.
        – Gilles
        Oct 16 '13 at 9:12










      • My one is better. Compare number of letters.
        – polar bear on the white snow
        Oct 16 '13 at 12:33












      • 1




        A Python answer has already been given. AIX does not have Python installed by default.
        – Gilles
        Oct 16 '13 at 9:12










      • My one is better. Compare number of letters.
        – polar bear on the white snow
        Oct 16 '13 at 12:33







      1




      1




      A Python answer has already been given. AIX does not have Python installed by default.
      – Gilles
      Oct 16 '13 at 9:12




      A Python answer has already been given. AIX does not have Python installed by default.
      – Gilles
      Oct 16 '13 at 9:12












      My one is better. Compare number of letters.
      – polar bear on the white snow
      Oct 16 '13 at 12:33




      My one is better. Compare number of letters.
      – polar bear on the white snow
      Oct 16 '13 at 12:33










      up vote
      1
      down vote













      A bit more perlish:



      echo 1397028688|perl -l12ne 'print scalar localtime $_'
      Wed Apr 9 09:31:28 2014





      share|improve this answer
























        up vote
        1
        down vote













        A bit more perlish:



        echo 1397028688|perl -l12ne 'print scalar localtime $_'
        Wed Apr 9 09:31:28 2014





        share|improve this answer






















          up vote
          1
          down vote










          up vote
          1
          down vote









          A bit more perlish:



          echo 1397028688|perl -l12ne 'print scalar localtime $_'
          Wed Apr 9 09:31:28 2014





          share|improve this answer












          A bit more perlish:



          echo 1397028688|perl -l12ne 'print scalar localtime $_'
          Wed Apr 9 09:31:28 2014






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 9 '14 at 7:32









          konlux

          111




          111




















              up vote
              0
              down vote













              AIX has ksh93, so:




              • local time (here mainland Britain):



                $ ksh93 -c 'printf "%(%Y-%m-%d %T %z)Tn" "#$1"' ksh93 1381260225
                2013-10-08 20:23:45 +0100



              • GMT/UTC



                $ TZ=GMT0 ksh93 -c 'printf "%(%Y-%m-%d %T %Z)Tn" "#$1"' ksh93 1381260225
                2013-10-08 19:23:45 GMT






              share|improve this answer
























                up vote
                0
                down vote













                AIX has ksh93, so:




                • local time (here mainland Britain):



                  $ ksh93 -c 'printf "%(%Y-%m-%d %T %z)Tn" "#$1"' ksh93 1381260225
                  2013-10-08 20:23:45 +0100



                • GMT/UTC



                  $ TZ=GMT0 ksh93 -c 'printf "%(%Y-%m-%d %T %Z)Tn" "#$1"' ksh93 1381260225
                  2013-10-08 19:23:45 GMT






                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  AIX has ksh93, so:




                  • local time (here mainland Britain):



                    $ ksh93 -c 'printf "%(%Y-%m-%d %T %z)Tn" "#$1"' ksh93 1381260225
                    2013-10-08 20:23:45 +0100



                  • GMT/UTC



                    $ TZ=GMT0 ksh93 -c 'printf "%(%Y-%m-%d %T %Z)Tn" "#$1"' ksh93 1381260225
                    2013-10-08 19:23:45 GMT






                  share|improve this answer












                  AIX has ksh93, so:




                  • local time (here mainland Britain):



                    $ ksh93 -c 'printf "%(%Y-%m-%d %T %z)Tn" "#$1"' ksh93 1381260225
                    2013-10-08 20:23:45 +0100



                  • GMT/UTC



                    $ TZ=GMT0 ksh93 -c 'printf "%(%Y-%m-%d %T %Z)Tn" "#$1"' ksh93 1381260225
                    2013-10-08 19:23:45 GMT







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 19 at 9:26









                  Stéphane Chazelas

                  287k53528867




                  287k53528867




















                      up vote
                      -4
                      down vote













                      what about something like this ??



                      echo "`date +"%y%m%d%H%M%S"`"





                      share|improve this answer


















                      • 1




                        You meant echo "$(date +"%y%m%d%H%M%S")" but it only outputs the Unix timestamp of the current date. The question was about converting a specified Unix timestamp to a human-readable date string.
                        – telcoM
                        Sep 19 at 9:11










                      • You're using backticks so the double quotes don't nest. Consider using the more modern style $( ... ) instead.
                        – roaima
                        Sep 19 at 11:54














                      up vote
                      -4
                      down vote













                      what about something like this ??



                      echo "`date +"%y%m%d%H%M%S"`"





                      share|improve this answer


















                      • 1




                        You meant echo "$(date +"%y%m%d%H%M%S")" but it only outputs the Unix timestamp of the current date. The question was about converting a specified Unix timestamp to a human-readable date string.
                        – telcoM
                        Sep 19 at 9:11










                      • You're using backticks so the double quotes don't nest. Consider using the more modern style $( ... ) instead.
                        – roaima
                        Sep 19 at 11:54












                      up vote
                      -4
                      down vote










                      up vote
                      -4
                      down vote









                      what about something like this ??



                      echo "`date +"%y%m%d%H%M%S"`"





                      share|improve this answer














                      what about something like this ??



                      echo "`date +"%y%m%d%H%M%S"`"






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Sep 19 at 11:54









                      roaima

                      40.7k547110




                      40.7k547110










                      answered Sep 19 at 8:52









                      ripnew

                      1




                      1







                      • 1




                        You meant echo "$(date +"%y%m%d%H%M%S")" but it only outputs the Unix timestamp of the current date. The question was about converting a specified Unix timestamp to a human-readable date string.
                        – telcoM
                        Sep 19 at 9:11










                      • You're using backticks so the double quotes don't nest. Consider using the more modern style $( ... ) instead.
                        – roaima
                        Sep 19 at 11:54












                      • 1




                        You meant echo "$(date +"%y%m%d%H%M%S")" but it only outputs the Unix timestamp of the current date. The question was about converting a specified Unix timestamp to a human-readable date string.
                        – telcoM
                        Sep 19 at 9:11










                      • You're using backticks so the double quotes don't nest. Consider using the more modern style $( ... ) instead.
                        – roaima
                        Sep 19 at 11:54







                      1




                      1




                      You meant echo "$(date +"%y%m%d%H%M%S")" but it only outputs the Unix timestamp of the current date. The question was about converting a specified Unix timestamp to a human-readable date string.
                      – telcoM
                      Sep 19 at 9:11




                      You meant echo "$(date +"%y%m%d%H%M%S")" but it only outputs the Unix timestamp of the current date. The question was about converting a specified Unix timestamp to a human-readable date string.
                      – telcoM
                      Sep 19 at 9:11












                      You're using backticks so the double quotes don't nest. Consider using the more modern style $( ... ) instead.
                      – roaima
                      Sep 19 at 11:54




                      You're using backticks so the double quotes don't nest. Consider using the more modern style $( ... ) instead.
                      – roaima
                      Sep 19 at 11:54

















                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f96189%2fconvert-unix-timestamp-into-human-readable-format-on-aix%23new-answer', 'question_page');

                      );

                      Post as a guest