Printing previous dates with the FreeBSD date utility

In a previous post, I described how to get the date for a day in the past. This method unfortunately doesn’t work on FreeBSD hosts, since FreeBSD doesn’t come with the GNU date utility. As an alternative to GNU date, you can pass a time value to the date utilities “-v” option to print a date in the past:

$ date -v-2d
Mon Jan 1 13:02:57 EST 2007

I think I prefer the GNU date syntax, but this seems to work pretty well.

1 thought on “Printing previous dates with the FreeBSD date utility”

  1. Sweet, thanks Matty!

    I’ve gleaned so much useful info from your site, I feel like I owe you a beer.. or three. If you’re every in Edmonton look me up.

    -J

Leave a Reply

Your email address will not be published. Required fields are marked *