This question already has an answer here:
I have got this issue:
Notice: Undefined offset: 1 in every row of
$news_date[1]
.
Here are my code:
$news_date=explode("-",$press_date);
if($news_date[1]==1){
$news_date[1]='JAN';
}else if($news_date[1]==2){
$news_date[1]='FEB';
} //and so on..
$press_date=$news_date[1].', '.$news_date[0];
I stored date data with news_date
field.
Please kindly suggestion How can I should do.
Thank you very much in advance.
*** Editable**** After ask via Stack now I have used these code to solve my problem. It is just using 3 lines. Thank you Adrian Preuss for your suggestion.
$press_date=$rs['news_date']; // store data from DB
$new_formatDate=date("M d, Y",strtotime($press_date)); // Set Date Month Year styles that I want
$new_formatDate = strtoupper($new_formatDate); // Make it to ALL CAP
</div>