开发者

PHP - Display the current date in words?

Is there a wa开发者_高级运维y 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


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

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


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').

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜