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? Link to comment https://forums.phpfreaks.com/topic/77407-solved-easy-date-question-i-think/ 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 ?> Link to comment https://forums.phpfreaks.com/topic/77407-solved-easy-date-question-i-think/#findComment-391865 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). Link to comment https://forums.phpfreaks.com/topic/77407-solved-easy-date-question-i-think/#findComment-391906 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.