Introduction

The date command can be very useful for advanced date calculations.

Usage

  • Calculates the date 2 weeks ago from Saturday in the specified format:
  date -d '2 weeks ago Saturday' +%Y-%m-%d
  
  • Unix alias for date command that lets you create timestamps in ISO 8601 format:
  alias timestamp='date "+%Y%m%dT%H%M%S"'
  

Last updated 27 Nov 2009, 20:18 +0200. history