[linux-elitists] Show Us The Code

Marc MERLIN marc@merlins.org
Sat Mar 3 07:38:27 PST 2007


On Thu, Mar 01, 2007 at 09:02:04PM +0100, Michael Dominok wrote:
> > Anyway, I went around using "date --iso-8601" in bash scripts for years
> > before someone pointed out to me that "date -I" does the same thing.
> 
> Having looked through the man page several times in search of the -I
> option i found date +%F which is equivalent to date +%Y-%m-%d too.

I have another fun one I wrote a while ago:
convert epoch time into string time

epocdate2str () {
    date -d "1970-01-01 $1 sec UTC" "+%Y/%m/%d %H:%M:%S"
}

Is there a better way to do this in shell?

Marc
-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems & security ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/



More information about the linux-elitists mailing list