klinmy Posted April 13, 2006 Share Posted April 13, 2006 i would like to ask how to extract the month from a date? i saved the date in yyyy/mm/dd format, and how do i need todo in order to know whether the date is in Jan, Feb or so on?thanks. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 13, 2006 Share Posted April 13, 2006 You can use a combination of the [a href=\"http://www.php.net/strtotime\" target=\"_blank\"]strtotime()[/a] and [a href=\"http://www.php.net/date\" target=\"_blank\"]date()[/a] functions:[code]<?php$date = '2006/06/01';echo date('F',strtotime($date));?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
klinmy Posted April 13, 2006 Author Share Posted April 13, 2006 thanks alot Ken! Quote Link to comment Share on other sites More sharing options...
klinmy Posted April 13, 2006 Author Share Posted April 13, 2006 sorry, i have another question regarding to this. can i save the value of "echo date('F',strtotime($date));" into database? how am i suppose to tht?? thanks Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 13, 2006 Share Posted April 13, 2006 Instead of echoing the result, assign it to a variable and do whatever you want with it.[code]<?php$date = '2006/06/01';$var = date('F',strtotime($date));?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
klinmy Posted April 13, 2006 Author Share Posted April 13, 2006 it's done. :Dthanks really 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.