rempires Posted November 15, 2007 Share Posted November 15, 2007 i'm pulling a lot fo dates out a database were the stored as Nov 20 1965 in 3 separate fields (there not in a date field because a lot of times i'm only working with 1 of them, or using them in the WHERE clause as only month or only day) anyway my question is how do i easy convert something like Nov to 10, the date function in php seems only capable of handling it when there is a time stamp. is there a php function i can make say hey Nov = 10? Quote Link to comment Share on other sites More sharing options...
Daukan Posted November 15, 2007 Share Posted November 15, 2007 You could make your own array of the months <?php $months = array( 'jan'=>1, 'feb'=>2. 'mar'=>3);//ect... $month = $months['jan']; //result is 1 ?> Quote Link to comment Share on other sites More sharing options...
gin Posted November 15, 2007 Share Posted November 15, 2007 Actually, if it's a MySQL db, you can work with just a month or day from a date field by SELECTing MONTH(date) or DAY(date). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.