command line
To see the current time from the Ubuntu or Linux command line: date which will give you: Fri May 30 15:53:21 EDT 2008 To see how to include and format dates and times in your shell scripts, see this post: http://www.lifeonubuntu.com/2008/05/how-to-format-dates-in-shell-scripts.html
Read the full article →
date time
When using dates in a shell script, you can format them like this: $(date +[format]) Here are some examples: $(date +”%Y%m%d)20080508 ——————– $(date +”%Y-%m-%d)2008-05-08 ——————– $(date +%D) which is shorthand equivalent for $(date +”%m/%d/%Y) 05/08/2008 To include time: $(date +%r) 10:15:36 PM ——————– $(date +%T) 22:15:36 A typical date format for a log entry: $(date [...]
Read the full article →