Saturday, April 23, 2011

Finding anything for any day other than current(--date parameter of date command)

In Linux when you want to know date you just write "date" command and get current date and by passing parameter you can get any information of today in any format.

But the problem arise when you want to know specific details about any date other than today

For example Today is 23-04-2011 and you want to know the weekday on 05-01-2011.And weekday count on 05-01-2011 like (sun-7,mon-1,tue-2 etc.)

Then you can also know that by date command :)


You just need to use --date parameter of date command

date +%u --date="2011-01-05"

Weekday

date +%A --date="2011-01-05"

No comments: