Shadab Hussain
Shadab Hussain

Reputation: 19

Different date format in UNIX and Linux server

I am migrating all my script from UNIX server to Linux server, but both the server have different date format.

How I can make both format same ?

UNIX: bash-3.2$ date Tuesday, 25 October 2016 15:57:04 BST

LINUX: [ess@gmessd04 ~]$ date Tue 25 Oct 16:01:20 BST 2016

Unix server version : SunOS 5.10

Linux server version : Linux 3.10

Thanks, Shadab Hussain

Upvotes: 0

Views: 676

Answers (1)

sebkrueger
sebkrueger

Reputation: 386

You could use the parameter of the date command to get the same result on linux you have on unix.

$date "+%A, %d %B %k:%M:%S %Z" 

For more info about the date modifier see manpage of date command:

$man date

If you need like to change the output of date without typing the parameter all the time, you could set it as alias:

$alias date='date "+%A, %d %B %k:%M:%S %Z"'

Upvotes: 1

Related Questions