How to display date...
 

How to display date in DD-MMM-YYYY format

2 Posts
1 Users
0 Likes
1,913 Views
Avatar of admin
Posts: 77
 admin
Admin
Topic starter
(@mjv119gmail-com)
Estimable Member
Joined: 9 years ago

I want to show unix date in DD-MMM-YYYY format. Month field should be in three letter capital alphapet and date and year in numerical.

example: 22-OCT-2015

I tried the below shell code but it shows in small letters. Can anyone help me to get this work?

$ date ‘+%d-%h-%Y’
22-oct-2015

Reply
1 Reply
Avatar of admin
Posts: 77
 admin
Admin
Topic starter
(@mjv119gmail-com)
Estimable Member
Joined: 9 years ago

Use translate command (tr) to change to uppercase as shown below.

date ‘+%d-%h-%Y’ | tr [:lower:] [:upper:]

Reply

Leave a reply

Author Name

Author Email

Title *

 
Preview 0 Revisions Saved
Share: