[Nottingham] A little help with date

James Gibbon jg at jamesgibbon.com
Sat Jan 10 10:51:16 UTC 2009

On Sat, 10 Jan 2009 09:49:52 +0000
"Danny King" <dannyking at gmail.com> wrote:

> Hello all,
> After the recent discussion about text to speech software I thought it
> would be fun and geeky to be greeted with a hello, today's date and
> the weather (or something). So far I have achieved this using the date
> command:
> Good morning Danny, It is 09:47 on Saturday the 10 of January, 2009
> But I would like the day's number to be read as "tenth", "second",
> "sixteenth", etc rather than just "ten". Does anyone know how I can
> get date to output that sort of thing?

I'm unaware of a version of date that supports that, so you might
store the strings (first, second, third etc) in an array. However you
wouldn't need all 31. For 21-29 you can use "twenty" + (eg) "first",
same approach for 30 & 31.


More information about the Nottingham mailing list