Previous month name |
[eluser]Sawariya[/eluser]
hi friends how to get previous month name according to server date...?? anybody can help me?? thanks in advance
[eluser]Lone[/eluser]
All you need to know on this is at the following link PHP.net Date Function
[eluser]ejangi[/eluser]
You could do something to the effect of: Code: $month_name = date('F', (time()-(60*60*24*30))); It's a bit hack-ish, but it should work and may spark a better solution.
[eluser]Lone[/eluser]
Ok, you got me thinking on this and its not that easy to achieve in one line really because if month is January then current month less one is 0 not 12. ucantblamem's solution is a good quick fix but the issue is obvious that not all months have 30 days... Heres the best solution I could come up with - any suggestions welcome (such as something cleaner then mktime?). Code: if( ($monthPrevious = 1-1) == 0) { A previous date function in the date helper could come handy looking at this
[eluser]Lone[/eluser]
xwero wins! strtotime is such a magical function at times |
Welcome Guest, Not a member yet? Register Sign In |