Ubuntu: How to View the Current Date and Time via Command Line CodeUnit 14 JUN 2010

If you are working on an Ubuntu server installation that comes in the command line only variation, you might at any point in time want to see just what exactly the server’s time is currently set to.

Needless to say, getting the current date and time information is pretty damn easy – simply call:

date

Seriously, as simple as that.

Now if you wanted to say change the date or time on the server, it turns out that this is pretty simple to acheive as well:

Simply provide a parameter to the date function!

So we would then have:

sudo date newdatetimestring

Of course, you won’t exactly use “newdatetimestring”, rather it stands for the date time format “nnddhhmmyyy.ss” where nn is a two digit month (01 to 12), dd is a two digit day (01 to 31), hh is two digit hour (00 to 23), yyyy a four digit year and finally .ss which is two digit seconds (00 to 59) [notice the ‘period’ there by the way].

Nice!

Related Posts:

About Craig Lotter

Software developer, husband and dad to two little girls. Writer behind An Exploring South African. I don't have time for myself any more.