Re: find yesterday date using date command
Re: find yesterday date using date command
- Subject: Re: find yesterday date using date command
- From: Doug McNutt <email@hidden>
- Date: Mon, 1 Jan 2007 11:59:17 -0700
At 10:14 -0800 1/1/07, Hung Phan wrote:
>I try to write a backup script that which move older files into the previous date folder. Search throughout Google for a way to get yesterday date using "date" command, no luck. Can someone help me with this please?
It's a pain. Apple does not like to have plain old users have access to the numbers that constitute the number of seconds from 1904 (MacOS) or 1970 (UNIX).
In Microsoft Excel one can get yesterday's date by simply subtracting one from the a code as though it were a floating point number.
In MPW (Not available on OS neXt)
date Monday, January 1, 2007 11:24:51
date -n 3250495256 (The seconds since 1904)
subtract seconds in a day, 86400, to get 3250408856
date -c 3250408856 Sunday, December 31, 2006 11:20:56
The difference being that I was interrupted with a cup of coffee.
The UNIX date command has some of that capability but not enough.
man date in Terminal.app for more.
perl's date handling will do it nicely but it takes a couple of lines and will probably require a script stored in a file. Ask off line if you'd like an example. Somewhere I have one that gets a good date for requesting a stock report automatically.
--
--> From the U S of A, the only socialist country that refuses to admit it. <--
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden