On Tue, Oct 30, 2012 at 08:56:24PM +0100, Dan Shelton wrote:
> Can ksh93 printf "%T" be used to convert dates from ls -l to absolute
> dates?

The responses so far have been correct, of course, answering your question
directly.  I just wanted to point out, though, that if you have ast-open (that
is, not just ksh), the ls(1) therein can do this for you directly with no need
for a printf conversion.  Look to the -z and -Z options.

    : rtfm; ls -l -z long-iso /etc/motd
    -rw-r--r-- 1 root wheel 64 2012-06-27 14:46:24 /etc/motd

    : rtfm; ls -l -z full-iso /etc/motd
    -rw-r--r-- 1 root wheel 64 2012-06-27 14:46:24.000000000 -0400 /etc/motd

    : rtfm; ls -Z '%(mtime)s' /etc/motd
    Jun 27 14:46

    : rtfm; ls -Z '%(mtime:time=%K)s' /etc/motd
    2012-06-27+14:46:24

    : rtfm; ls -Z '%(mtime:time=%_K)s' /etc/motd
    2012-06-27 14:46:24

    : rtfm; ls -Z '%(mtime:time=%EK)s' /etc/motd 
    2012-06-27+14:46:24.000000000-0400

    : rtfm; ls -Z '%(mtime:time=%_EK)s' /etc/motd
    2012-06-27 14:46:24.000000000 -0400

Cheers,
Bob


-- 
Bob Krzaczek, Chester F. Carlson Center for Imaging Science, RIT
phone +1-585-4757196, email [email protected], icbm 43.08586N 77.67744W
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to