coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Print modification time in compact form


From: William Bader
Subject: Re: Print modification time in compact form
Date: Tue, 16 Mar 2021 04:56:14 +0000

> $ stat -c '%y' file.txt
> 2017-07-31 17:50:54.000000000 +0100
> Is there a way to directly print it as 20170731-1750? Thanks.

date --date="@$(stat -c '%Y' file.txt)" '+%+4Y%m%d-%H%M'

________________________________
From: coreutils <coreutils-bounces+williambader=hotmail.com@gnu.org> on behalf 
of Peng Yu <pengyu.ut@gmail.com>
Sent: Monday, March 15, 2021 10:16 PM
To: Coreutils <coreutils@gnu.org>
Subject: Print modification time in compact form

Hi,

I see modification time can be printed in this format.

$ stat -c '%y' file.txt
2017-07-31 17:50:54.000000000 +0100

Is there a way to directly print it as 20170731-1750? Thanks.

--
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]