Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using $date command in a Unix script and it is giving as "Tue Aug 27 05:53:37 EDT 2013".

This is coming as an automatic mail.

The timestamp value is long and it wraps to new line.

How can I adjust command such that time format does not wrap into new line?

share|improve this question

This should do the trick:

DATE=`date +%Y-%m-%d`

If you do man date, you will find all possible placeholders to construct your date string.

share|improve this answer

man date shows all possible output options, you coud for example use

$ date +%D
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.