Convert Unix timestamp into human-readable format on AIX

Clash 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.
ksh date aix timestamps
add a comment |Â
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.
ksh date aix timestamps
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 doeswhich perlreturn on the server? Also, give that relies on your path and we don't know what that is, how aboutls -l /usr/bin/perl.
â EightBitTony
Apr 9 '14 at 7:58
add a comment |Â
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.
ksh date aix timestamps
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
ksh date aix timestamps
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 doeswhich perlreturn on the server? Also, give that relies on your path and we don't know what that is, how aboutls -l /usr/bin/perl.
â EightBitTony
Apr 9 '14 at 7:58
add a comment |Â
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 doeswhich perlreturn on the server? Also, give that relies on your path and we don't know what that is, how aboutls -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
add a comment |Â
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.
1
date -dis a GNU-ism. The equivalent for OpenBSD would bedate -r 1381260225. And I'm not even sure that is standard, because Solaris doesn't even have an equivalent of-dor-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-reither, see here. I think RahulPatil'sawksolution 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 havestrftime(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
 |Â
show 2 more comments
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
1
+1 but if I'm not mistaken, AIX does not have Perl by default and I don't know whetherPOSIX::strftimewill 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
add a comment |Â
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
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
add a comment |Â
up vote
1
down vote
A bit more perlish:
echo 1397028688|perl -l12ne 'print scalar localtime $_'
Wed Apr 9 09:31:28 2014
add a comment |Â
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 +0100GMT/UTC
$ TZ=GMT0 ksh93 -c 'printf "%(%Y-%m-%d %T %Z)Tn" "#$1"' ksh93 1381260225
2013-10-08 19:23:45 GMT
add a comment |Â
up vote
-4
down vote
what about something like this ??
echo "`date +"%y%m%d%H%M%S"`"
1
You meantecho "$(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
add a comment |Â
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.
1
date -dis a GNU-ism. The equivalent for OpenBSD would bedate -r 1381260225. And I'm not even sure that is standard, because Solaris doesn't even have an equivalent of-dor-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-reither, see here. I think RahulPatil'sawksolution 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 havestrftime(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
 |Â
show 2 more comments
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.
1
date -dis a GNU-ism. The equivalent for OpenBSD would bedate -r 1381260225. And I'm not even sure that is standard, because Solaris doesn't even have an equivalent of-dor-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-reither, see here. I think RahulPatil'sawksolution 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 havestrftime(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
 |Â
show 2 more comments
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.
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.
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 -dis a GNU-ism. The equivalent for OpenBSD would bedate -r 1381260225. And I'm not even sure that is standard, because Solaris doesn't even have an equivalent of-dor-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-reither, see here. I think RahulPatil'sawksolution 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 havestrftime(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
 |Â
show 2 more comments
1
date -dis a GNU-ism. The equivalent for OpenBSD would bedate -r 1381260225. And I'm not even sure that is standard, because Solaris doesn't even have an equivalent of-dor-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-reither, see here. I think RahulPatil'sawksolution 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 havestrftime(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
 |Â
show 2 more comments
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
1
+1 but if I'm not mistaken, AIX does not have Perl by default and I don't know whetherPOSIX::strftimewill 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
add a comment |Â
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
1
+1 but if I'm not mistaken, AIX does not have Perl by default and I don't know whetherPOSIX::strftimewill 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
add a comment |Â
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
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
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 whetherPOSIX::strftimewill 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
add a comment |Â
1
+1 but if I'm not mistaken, AIX does not have Perl by default and I don't know whetherPOSIX::strftimewill 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
add a comment |Â
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
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
add a comment |Â
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
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
add a comment |Â
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
# echo 1381260225 | python -c 'import sys; import time; print time.ctime( float( sys.stdin.read() ) )'
Wed Oct 9 02:23:45 2013
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
add a comment |Â
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
add a comment |Â
up vote
1
down vote
A bit more perlish:
echo 1397028688|perl -l12ne 'print scalar localtime $_'
Wed Apr 9 09:31:28 2014
add a comment |Â
up vote
1
down vote
A bit more perlish:
echo 1397028688|perl -l12ne 'print scalar localtime $_'
Wed Apr 9 09:31:28 2014
add a comment |Â
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
A bit more perlish:
echo 1397028688|perl -l12ne 'print scalar localtime $_'
Wed Apr 9 09:31:28 2014
answered Apr 9 '14 at 7:32
konlux
111
111
add a comment |Â
add a comment |Â
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 +0100GMT/UTC
$ TZ=GMT0 ksh93 -c 'printf "%(%Y-%m-%d %T %Z)Tn" "#$1"' ksh93 1381260225
2013-10-08 19:23:45 GMT
add a comment |Â
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 +0100GMT/UTC
$ TZ=GMT0 ksh93 -c 'printf "%(%Y-%m-%d %T %Z)Tn" "#$1"' ksh93 1381260225
2013-10-08 19:23:45 GMT
add a comment |Â
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 +0100GMT/UTC
$ TZ=GMT0 ksh93 -c 'printf "%(%Y-%m-%d %T %Z)Tn" "#$1"' ksh93 1381260225
2013-10-08 19:23:45 GMT
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 +0100GMT/UTC
$ TZ=GMT0 ksh93 -c 'printf "%(%Y-%m-%d %T %Z)Tn" "#$1"' ksh93 1381260225
2013-10-08 19:23:45 GMT
answered Sep 19 at 9:26
Stéphane Chazelas
287k53528867
287k53528867
add a comment |Â
add a comment |Â
up vote
-4
down vote
what about something like this ??
echo "`date +"%y%m%d%H%M%S"`"
1
You meantecho "$(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
add a comment |Â
up vote
-4
down vote
what about something like this ??
echo "`date +"%y%m%d%H%M%S"`"
1
You meantecho "$(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
add a comment |Â
up vote
-4
down vote
up vote
-4
down vote
what about something like this ??
echo "`date +"%y%m%d%H%M%S"`"
what about something like this ??
echo "`date +"%y%m%d%H%M%S"`"
edited Sep 19 at 11:54
roaima
40.7k547110
40.7k547110
answered Sep 19 at 8:52
ripnew
1
1
1
You meantecho "$(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
add a comment |Â
1
You meantecho "$(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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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 perlreturn on the server? Also, give that relies on your path and we don't know what that is, how aboutls -l /usr/bin/perl.â EightBitTony
Apr 9 '14 at 7:58