Results 1 to 7 of 7
Sould be very easy. If I have `date '+%d-%B-%Y'` in a shell script, and have:
echo `date '+%d-%B-%Y'`
It will show 21-April-2005
I would like it to show 21-04-2005, and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-21-2005 #1Just Joined!
- Join Date
- Apr 2005
- Posts
- 3
help with `date '+%d-%B-%Y'`
Sould be very easy. If I have `date '+%d-%B-%Y'` in a shell script, and have:
echo `date '+%d-%B-%Y'`
It will show 21-April-2005
I would like it to show 21-04-2005, and need it also to read 21-4-2005, 21-04-05
Thanks for you help.
-Jeremy
- 04-21-2005 #2Linux Guru
- Join Date
- Mar 2003
- Location
- Wisconsin
- Posts
- 1,907
How about
%d-%m-%y
http://unixhelp.ed.ac.uk/CGI/man-cgi?date
BTW... Excellent name, dude.

JeremyRegistered Linux user #346571
"All The Dude ever wanted was his rug back" - The Dude
- 04-21-2005 #3Just Joined!
- Join Date
- Apr 2005
- Posts
- 3
Very Good. That made my day, post a message, and see the response from myself
Originally Posted by jeremy1701
Just Kidding
Thanks for the url. But I see one thing wrong, I do it see anywhere to do like 4-21-2005 or 4-21-05, what about some where in the script to look for 01 -09 and take the 0 off?
-Jeremy
- 04-21-2005 #4Linux Guru
- Join Date
- Mar 2003
- Location
- Wisconsin
- Posts
- 1,907
I guess I don't understand what you're asking for here. If you want a double-digit year rather then a four digit year, use %y rather then %Y. If you need to read a date and convert it from one form to another, you're going to have to write a little code. If you need help doing that, post what you've got and we can see where you're at.
Originally Posted by jsgehris
JeremyRegistered Linux user #346571
"All The Dude ever wanted was his rug back" - The Dude
- 04-21-2005 #5Just Joined!
- Join Date
- Apr 2005
- Posts
- 3
Ok, I see the year to make it 2, sorry. All I am doing is makeing dirs a cron job, and copying reports at work. They are picky about folder dates, and always say I want this and that for folder dates, and say if you can do it one way, you can do it another. The only other day format I do not see is exp 4-21-05 drop the 04. I have no clue how to do this. Makeing dirs it one thing. I know they sould not complane about the 0 but they do.
-Jeremy
- 04-21-2005 #6Linux Guru
- Join Date
- Mar 2003
- Location
- Wisconsin
- Posts
- 1,907
I don't see it either. I think you'll have to script that one. Shouldn't be too difficult.

JeremyRegistered Linux user #346571
"All The Dude ever wanted was his rug back" - The Dude
- 04-21-2005 #7
You could probably use sed to take the 0 off the beginning. I know no sed, but I'm fairly certain that's possible in it.

OTOH, it's quite possible in perl regexps.
"Time is an illusion. Lunchtime, doubly so."
~Douglas Adams, The Hitchhiker's Guide to the Galaxy


Reply With Quote
