iYesterday I discovered a nice feature of ksh93: It has         error.host      1
isupport for date manipulation with printf (ksh's builtin).             error.host      1
i               error.host      1
iSee this post:         error.host      1
ihttp://blog.fpmurphy.com/2008/11/korn-shell-93-secrets-1.html          error.host      1
i               error.host      1
iExamples (from the page above):                error.host      1
i               error.host      1
i$ printf "%Tn" "2:00pm yesterday"              error.host      1
iFri Mar 21 14:00:00 EST 2008           error.host      1
i               error.host      1
iprintf  "%(%a)Tn"  "final day Feb 2008"                error.host      1
iFri            error.host      1
i               error.host      1
i$ printf  "%(%D)Tn" "3rd wednesday may 2008"           error.host      1
i05/21/08               error.host      1
i               error.host      1
i$ printf  "%(%D)Tn" "4 weeks ago"              error.host      1
i02/18/08               error.host      1
i               error.host      1
iIt also understands crontab format:            error.host      1
i$ printf "%Tn" "0 0 1,15 * 1"          error.host      1
iMon Sep 1 00:00:00 EDT 2008            error.host      1
i               error.host      1
iAccording to Glenn Fowler[1] it's better to write the dates            error.host      1
ilike this:             error.host      1
i               error.host      1
i$ printf "%(%K)Tn" "Sept 23 2009 noon"         error.host      1
i2009-09-23+12:00:00            error.host      1
i               error.host      1
i$ printf "%(%K)Tn" "Sept 23 2009 noon 90 days"         error.host      1
i2009-12-22+12:00:00            error.host      1
i               error.host      1
i$ printf "%(%K)Tn" "Sept 23 2009 noon 90 days hence"           error.host      1
i2009-12-22+12:00:00            error.host      1
i               error.host      1
i$ printf "%(%K)Tn" "Sept 23 2009 noon 90 days ago"             error.host      1
i2009-06-25+12:00:00            error.host      1
i               error.host      1
iThat is, with the "reference date first" and the modifiers.            error.host      1
i               error.host      1
i--             error.host      1
i               error.host      1
i[1]            error.host      1
ihttp://www.mail-archive.com/ast-users@research.att.com/msg00680.html           error.host      1
i               error.host      1
7Post a comment /users/chr/log/comment.cgi?ksh93-printf-date.txt        sdf.lonestar.org        70
0Raw text       /users/chr/log/ksh93-printf-date.txt    sdf.lonestar.org        70