how to convert Month in words to its numeric equivalent....

$month = 'JANUARY';

// code to convert the month JANUARY to its numerical equivalent...

echo 'help please for the numerical JANUARY equivalent here';




Recommended Answers

All 5 Replies

Try the date_parse function.

Try this

$month = 'JANUARY';

echo $mon = date('m',strtotime($month));

and when inputting the date,
If you have control of the data form <select><option value='1'>January</option><option value='2'>February</option> etc helps...i got this code...from it

$month = strtoupper($_POST);
$conmonth = strtotime($month);
$new_month=idate('m', $conmonth);

if your problem solvec mark this thread as solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.