From owner-freebsd-questions@freebsd.org Fri Jul 12 18:48:21 2019 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA98215D2EC0 for ; Fri, 12 Jul 2019 18:48:20 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F2D486AEE for ; Fri, 12 Jul 2019 18:48:19 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([188.103.170.236]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPA (Nemesis) id 1N3Gok-1iUNse19z0-010JqL; Fri, 12 Jul 2019 20:42:50 +0200 Date: Fri, 12 Jul 2019 20:42:48 +0200 From: Polytropon To: Robert Fitzpatrick Cc: Robert Fitzpatrick via freebsd-questions Subject: Re: pkg query timestamp format Message-Id: <20190712204248.b79ccad6.freebsd@edvax.de> In-Reply-To: <5D28CD7B.40102@webtent.org> References: <5D28CD7B.40102@webtent.org> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:xMFMD+CLZw51kyaCFSllcqzzr8Jd5T0OTkXszBkok23jPPrmzrb C+MnwsFmvHD6xAs1GYzcbMZqa8khsUUJtxzLPCVDLzJXkfw+XpzdtiKw8TLr+Xdxn+NOZ9Q +MyOD8kay85V1+EtrWWPyXU1rnuyt5hbbxu79s/ZBPDpvUJZIW2XRdYB0Rna0EavpwiIEgy bLiQXCl+xGBP9jCiRKdFg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:shuiypIVpzM=:fl7xuz2izegq8Wyswwus5G 1RqTe0BiulUmmT2/456ew6TkR59V9FyA2AKblRl0bVUtIOFYjNn5NJ4vw9DfOv8lfbbZGIrFD vcR8f6/z0XsuhMaPJAFVyS8OWZ544ShckHO+ZO6ZKvan/YBGJbA/agY2ZOwXriSHOfDaZVeH0 UCo2izKIg3p1FPOOgsCadCEIiWBdC6YEQwrTU4/7ef1xzULjMbfqaWHNpshohzKdOsbTB2Xa0 Ywgapp0IO+0uZWbEY4u+d/4l7DLnsddZaPknaWfWdctaOg6aTmxjg7pF/GD881/BqSxXHVSV6 T8lvgFj6thwzJD+yU99CRwpRKMcViQIpXFZaUFAyvITBeblC66uUozLV4qaAEXCBluABjfmz5 VxUHy9XL0BxjCfrdnIoOOowO3i3GCCPSi0Tzgp/gwP29T0O2BymDHtrIe8c8f3DNPC7ztLVuv UZpwVS26riXte72hQMzb2nFMz6WRXvAymBfKH7SLb7x1KgjPO8+kXDP1r/Kv7Umj30IFKK2k8 CqUQtS9U6QdiZvhnvOtxQqb1KoABy6bAkh+s1FhnY3YPCRvKmRr5ByAD47aHFnG0mLWTXREIg DMkcgueHhDFu9t5+eLkakZKjTbTu0T2X9K/rlDhMjOu40OeyfSMrFLYuqjb0uonJFAER29I98 VNXCBAQT/LbogRpL4uZsb0EuqXWw24u+pJrRxTohCPHQNFiq1lsqGXXsgtJurCyAPQ1heTl3n 3cfV8ohmMQ7iBdFBaKzls9r/O0heAPpxRpzraIS/lG2qE61++qdpp/xLflw= X-Rspamd-Queue-Id: 3F2D486AEE X-Spamd-Bar: +++++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [5.96 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; MV_CASE(0.50)[]; HAS_ORG_HEADER(0.00)[]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: mx01.schlund.de]; RCPT_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_PBL(0.00)[236.170.103.188.zen.spamhaus.org : 127.0.0.11]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.99)[0.993,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.98)[0.976,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(1.00)[1.000,0]; RCVD_IN_DNSWL_NONE(0.00)[131.126.227.212.list.dnswl.org : 127.0.5.0]; MID_CONTAINS_FROM(1.00)[]; R_SPF_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; IP_SCORE(0.60)[ip: (2.03), ipnet: 212.227.0.0/16(-1.42), asn: 8560(2.41), country: DE(-0.01)] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:48:21 -0000 On Fri, 12 Jul 2019 14:12:11 -0400, 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 Judging from "man pkg-query", the %t information (timestamp of installation) cannot be changed into a different format. But according to "man date" and "man strftime", there is a solution, which is only _half_ a solution because my script foo fails to provide a way to keep the package name, but hey, the dates _can_ be converted. pkg query %n/%t | cut -d '/' -f 2 | xargs -n 1 -J @ date -j -f "%s" @ "+%Y-%m-%d_%H:%M:%S" I didn't find a way to feed one information of the $n/%t pair unaltered and uninterpreted (!) into date, but the conversion of the date Epoch -> YYYY-MM-DD_HH:MM:SS works. With an enclosing script it would probably be much easier, but at the moment, I can only provide this one-liner as an inspiration for further coding... :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...