Date: Sat, 30 Aug 2008 20:29:56 -0500 From: Paul Schmehl <pschmehl_lists@tx.rr.com> To: "Ivan \"Rambius\" Ivanov" <rambiusparkisanius@gmail.com>, FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: Formatting dates to a specific pattern Message-ID: <EE2163B05BDE434C6CD85CE0@Macintosh.local> In-Reply-To: <89ce7f740808301652g169fa4d2v3fe5eff06100e31e@mail.gmail.com> References: <89ce7f740808301652g169fa4d2v3fe5eff06100e31e@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--==========FCB22910116AE142E438========== Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline --On August 31, 2008 2:52:07 AM +0300 "Ivan \"Rambius\" Ivanov"=20 <rambiusparkisanius@gmail.com> wrote: > Hello, > > I need to format the current date (as returned by date(1) ) to the > pattern m-d-yyyy, where m is the month in one or digits, d is the day > in one or two digits, and yyyy is the year in four digits. The problem > for me is the day and the month, for example August should be 8, and > not 08, and 5th of September should be 9-5-2008 and not 09-05-2008. I > read the man page of date(1) but date(1) seems to always put leading > zeros. > > I appreciate any help on how to format the date the way I want. > # date "+%m-%d-%Y" | sed 's/^0//g' 8-30-2008 Paul Schmehl, If it isn't already obvious, my opinions are my own and not those of my employer. ****************************************** WARNING: Check the headers before replying --==========FCB22910116AE142E438==========--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EE2163B05BDE434C6CD85CE0>