# # User Friendly Date Script
APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed


I've removed advertising from most of this site and will eventually clean up the few pages where it remains.

While not terribly expensive to maintain, this does cost me something. If I don't get enough donations to cover that expense, I will be shutting the site down in early 2020.

If you found something useful today, please consider a small donation.

Some material is very old and may be incorrect today

© June 2001 Tony Lawrence

The Unix/Linux "date" command will display or set the current date and time, but ordinary folks find its syntax confusing. I wrote a little script that tries to make it a little less geeky.

The "setdate" is just a more user-friendly front end to changing the date and time:

echo -n "Enter Date or leave blank for `date +%m/%d/%y`: " 
read mydat
echo -n "Enter Time or leave blank for `date +%H:%M`: " 
read mytime
if [ "$mydat" != "" ]
      mmdd=`echo $mydat | sed 's/\///g;s/..$//'`
      yr=`echo $mydat | sed 's/\///g;s/^....//'`
      mmdd=`date +%m%d`
      yr=`date +%y`

if [ "$mytime" != "" ]
      newtime=`echo $mytime | sed 's/://g'`
      newtime=`date +%H%M`
date "$mmdd$newtime$yr"

This script works on Linux, SCO and most other Unixes.

Publish your articles, comments, book reviews or opinions here!

If you found something useful today, please consider a small donation.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> User Friendly Date Script

Inexpensive and informative Apple related e-books:

Take Control of Pages

Take Control of OS X Server

Take Control of Parallels Desktop 12

Sierra: A Take Control Crash Course

Digital Sharing Crash Course

More Articles by © Tony Lawrence

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

Today the theory of evolution is about as much open to doubt as the theory that the earth goes round the sun. (Richard Dawkins)

Linux posts

Troubleshooting posts

This post tagged:







Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode