feed-image  Delivered by FeedBurner  ISSN 1836-5930






Visitors Online

We have 56 guests online

Poll

Which of following tutorials would you like to see on the Linuxconfig.org?
 
Partner Linux Sites
TuxMachines
DebianAdmin
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
FreeSoftwareLinux
Jam's Ubuntu Blog
All For Linux

date
Article Index
1. Name
2. Synopsis
3. Frequently used options
4. Examples

1. Name

date [man page] - print or set the system date and time

2. Synopsis

date [OPTION]... [+FORMAT]
date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

3. Frequently used options

-u, --utc, --universal
print or set Coordinated Universal Time
+%F full date; same as %Y-%m-%d

4. Examples

date command is used to set up and display time. By typing date command without any options and arguments date displays current time:
$ date 
display current time with date command
date command can also be used to set time. However this require superuser permissions. To set time to 20th March 2010 23:45:28 we can use command:
# date 032023452010.28 
set time with date command
Date command is often used with connection to bash scripting for example to create simple backup scripts:
#!/bin/bash
OF=myhome_directory_$(date +%Y%m%d).tar.gz
tar -czf $OF /home/linuxconfig
bash backup script with date command
Or we can do something like this:
$ echo "Today is `date +%A` `date +%e`th of `date +%B` `date +%G` which is \
`date +%j`th day since 1th of January `date +%G`"
more options with date command