tags:

views:

57

answers:

2

Is there a way to use getdate (or similar) to output the current day in a format like this

twenty october twenty ten

I can't have the year as 'two thousand ten' due to space restrictions so it just needs to be 'twenty eleven' 'twenty twelve' etc

+3  A: 

Sure. Follow this tutorial then apply results to your date.

Note: you need to split year to two parts: 2010 = 20, 10

fabrik
Perfect, thanks!
Yammi
A lot of that is superfluous for this, since nothing above 99 would be needed. In fact, assuming a 32-bit time field, nothing above 38 would be needed, either. Of course, it's good to have the future in mind, as well as re-use in case you need to format other, larger numbers.
Aether
+1  A: 

Hi,

You can't do this with PHP's date function. You can only output the month as string. To do what you asked for you need to get a number to word function (plenty are available out there) and apply it on your day - numberToWord( date('j') ), first part of the year - numberToWord( substr(date('Y'), 0, 2) ) and second part of the year - numberToWord( substr(date('Y'), 2, 2) ). The month is date('F').

Alin Purcaru