This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

getting todays date

Help with usage of shell accounts and bouncers.
Post Reply
p
pinkel
Voice
Posts: 8
Joined: Wed May 21, 2008 2:59 pm

getting todays date

Post by pinkel »

How can I get todays date in format: mmdd

thanks
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Since you are posting in Shell & Bouncer Help, I assume you are writing a shellscript?
In such case, that would somewhat depend on your shell. Most do provide the date binary, which generally supports formatting (see http://unixhelp.ed.ac.uk/CGI/man-cgi?date ).

Something like this should do the trick (bash-style, other shells may have different syntax):

Code: Select all

somevar=`date +%m%d`
NML_375
Post Reply