1833875 Members
1872 Online
110063 Solutions
New Discussion

Date format

 
Ralf Buchhold
Regular Advisor

Date format

Hello
I want to find out what day we have:
Monday, Thuesday and so on to store it i a variable like: TODAYNAME=
Any idea ?

Thanks Ralf
4 REPLIES 4
Patrick Wallek
Honored Contributor

Re: Date format

TODAYNAME=$(date +%A)

the %A will return the Full day name, like Monday, Tuesday.

If you want the short name - Mon, Tue, etc.

TODAYNAME=$(date +%a)
Rodney Hills
Honored Contributor

Re: Date format

How about-

TODAYNAME=`date +"%A"`

HTH

-- Rod Hills
There be dragons...
Peter Godron
Honored Contributor

Re: Date format

Ralf,
looking at man date (2nd part)
would give you TODAYNAME=`date +"%A"`
Regards
A. Clay Stephenson
Acclaimed Contributor

Re: Date format

And because I have one date answer no matter what the question is:

TODAYNAME=$(caljd.sh -w -O)

for full weekday name or

TODAYNAME=$(caljd.sh -w -o)

for abbreviated weekday name.

This approach will let you do today, tomorrow, 5 days ago, ...

Invoke as caljd.sh for full usage and examples.

If it ain't broke, I can fix that.