Hi guys,
Given a month as a string, is there a simple way to find the numeric representation of said month?
I've used a switch statement but I'm wondring if there is a more elegant way of doing it?
Thanks in advance,
Rob.
Month String to Numeric?
Moderator: General Moderators
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
- markusn00b
- Forum Contributor
- Posts: 298
- Joined: Sat Oct 20, 2007 2:16 pm
- Location: York, England
Re: Month String to Numeric?
How about:
Code: Select all
echo date("m", strtotime'June'));
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Re: Month String to Numeric?
Many thanks - that works perfectly and of course is far more elegant!
You were missing a opening bracket though
Rob.
You were missing a opening bracket though
Rob.
- markusn00b
- Forum Contributor
- Posts: 298
- Joined: Sat Oct 20, 2007 2:16 pm
- Location: York, England
Re: Month String to Numeric?
My bad.robburne wrote:Many thanks - that works perfectly and of course is far more elegant!
You were missing a opening bracket though![]()
Rob.
You're welcome
Mark.