Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jul 2019 17:30:30 -0700
From:      David Christensen <dpchrist@holgerdanske.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: pkg query timestamp format
Message-ID:  <e2771f34-b0fe-5c09-dc8b-b2d549fdacbf@holgerdanske.com>
In-Reply-To: <5D28CD7B.40102@webtent.org>
References:  <5D28CD7B.40102@webtent.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 7/12/19 11:12 AM, Robert Fitzpatrick via freebsd-questions wrote:
> When I use the following command, I get packages with timestamp 
> installed in epoch Unix time. Is there any way to format that date into 
> month, day and year?
> 
> pkg query %n-%t

Here's a Perl one-liner:

2019-07-12 17:28:52 dpchrist@cvs ~
$ pkg query %n-%t | perl -ne '/(.+)-(\d+)$/; ($d,$m,$y)=(localtime 
$2)[3,4,5];$y+=1900; printf "%-50s %4i-%02i-%02i\n", $1, $y, $m ,$d'
bash                                               2019-01-21
cvs                                                2019-01-21
gettext-runtime                                    2019-01-21
<snip>


David



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e2771f34-b0fe-5c09-dc8b-b2d549fdacbf>