Date conversion question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Handler
Forum Newbie
Posts: 9
Joined: Wed Oct 13, 2004 9:02 pm
Location: Albany, NY USA
Contact:

Date conversion question

Post by Handler »

Greetings!

Guess this is a fairly simple question. But after going over the manual and looking at a few of the date functions I really couldn't find something that I wanted. 8O

What I'm looking for is a way to convert a number to the alpha month and then vice-versa. (ex 1 -> January and then January -> 1).

Thanks for the words of wisdom!

Handler
User avatar
dethron
Forum Contributor
Posts: 370
Joined: Sat Apr 27, 2002 11:39 am
Location: Istanbul

Post by dethron »

use array if there exists a one-to-one correspondence from alpha to month.

or if alphas are some valid date then use date() with "n"
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Yeah a simple 12 key [php_man]array()[/php_man] inside a function that also as a [php_man]foreach()[/php_man] loop & [php_man]if()[/php_man] statement should do the trick.
User avatar
dethron
Forum Contributor
Posts: 370
Joined: Sat Apr 27, 2002 11:39 am
Location: Istanbul

Post by dethron »

[php_man]foreach()[/php_man] and [php_man]if()[/php_man], hmmm i should think about them :lol:
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

8)
Post Reply