search

Loading
Showing posts with label date command. Show all posts
Showing posts with label date command. Show all posts

Friday, February 8, 2013

Finding the first day and last day of the last month using date command in linux

First day of Last Month = echo $(date --date "-1 month" +%Y-%m-01)
Last day of Last Month = echo $(date --date "-`date +%d` days -0 month" +%Y-%m-%d)

First day of Current Month = echo $(date --date "-0 month" +%Y-%m-01)
Last day of Current Month = echo $(date --date "-`date +%d` days +1 month" +%Y-%m-%d)

First day of Next Month = echo $(date --date "+1 month" +%Y-%m-01)
Last day of Next Month = echo $(date --date "-`date +%d` days +2 month" +%Y-%m-%d)

Monday, November 26, 2012

Changing time zone and time in Ubuntu/Linux

This is a quick tutorial. Here we check how to change time zone in linux as well as changing the server time using terminal.

For changing the time zone:

Your server time is in UTC and you want to change it to IST (Indian Standard Time). For this follow the below steps: