Web Hosting Talk







View Full Version : bash date conversion


Slidey
03-17-2005, 01:14 PM
i want to compare 2 dates in a bash script: today, and one in the format DD-MMM-YY (eg. 23-JAN-03).

has anyone done thsi before? and if so can you give me a function/any pointers?

All years >= 00

cheers

mfonda
03-17-2005, 03:27 PM
Heres some information on the date command, this might help you out a little bit:

http://linuxreviews.org/beginner/abs-guide/en/x7138.html
http://www.computerhope.com/unix/udate.htm

Hope that helps. I cant really test anything right now, but I will try and get something working when I can if you cant figure it out by then.

Slidey
03-17-2005, 03:32 PM
Hi mfonda

i've got a list of around 3 million in a file, and i want to compare each of them to today, so as to count the lines over (for example) 90 days old

i can get the current date, and ive started to write a function to split the date and count the days in between 2 arbitrary dates, but i wondered if someone had done similar before and could help speed things along..