How to display date in DD-MMM-YYYY format in UNIX or LINUX

Home Questions How to display date in DD-MMM-YYYY format in UNIX or LINUX

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by   2 years, 3 months ago.

  • Author
    Posts
  • #6649 Reply

    admin
    Keymaster
    Offline
    Topics: 65
    Replies: 65

    Hi eTechTricks Users, 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

  • #6737 Reply

    admin
    Keymaster
    Offline
    Topics: 65
    Replies: 65

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

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

Reply To: How to display date in DD-MMM-YYYY format in UNIX or LINUX

You can use BBCodes to format your content.
Your account can't use Advanced BBCodes, they will be stripped before saving.

Your information: