From owner-freebsd-questions@FreeBSD.ORG Sun Aug 31 02:02:11 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 656CD106564A for ; Sun, 31 Aug 2008 02:02:11 +0000 (UTC) (envelope-from pschmehl_lists@tx.rr.com) Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.123]) by mx1.freebsd.org (Postfix) with ESMTP id 240FE8FC19 for ; Sun, 31 Aug 2008 02:02:11 +0000 (UTC) (envelope-from pschmehl_lists@tx.rr.com) Received: from [192.168.2.102] (really [24.175.90.48]) by cdptpa-omta04.mail.rr.com with ESMTP id <20080831012957.UYJW13299.cdptpa-omta04.mail.rr.com@[192.168.2.102]>; Sun, 31 Aug 2008 01:29:57 +0000 Date: Sat, 30 Aug 2008 20:29:56 -0500 From: Paul Schmehl To: "Ivan \"Rambius\" Ivanov" , FreeBSD Questions Message-ID: In-Reply-To: <89ce7f740808301652g169fa4d2v3fe5eff06100e31e@mail.gmail.com> References: <89ce7f740808301652g169fa4d2v3fe5eff06100e31e@mail.gmail.com> X-Mailer: Mulberry/4.0.8 (Mac OS X) X-Munged-Reply-To: To reply - figure it out MIME-Version: 1.0 Content-Type: multipart/signed; micalg=sha1; protocol="application/pkcs7-signature"; boundary="==========FCB22910116AE142E438==========" X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: Formatting dates to a specific pattern X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Paul Schmehl List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Aug 2008 02:02:11 -0000 --==========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 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==========--