The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

PHP date_create()

DelzhandDelzhand Registered User, Transition Team regular
edited December 2010 in Help / Advice Forum
Does anyone know if it is possible to use PHP's date_create() to return the next 1st of the month? How about the next>next last day of the month?

For example, given today's date, can I get January 1st 2011 and February 28th 2011

Delzhand on

Posts

  • bowenbowen Sup? Registered User regular
    edited December 2010
    Well you can do that with PHP, I guess, you want the first day of the next month, then the last day of the following month right?

    (You'll want mktime)

    bowen on
    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • DelzhandDelzhand Registered User, Transition Team regular
    edited December 2010
    Ehh. I'm working with Drupal's Views module, and I only have a text field where I can enter a value. I'll probably just expose the filter and let the user select the date range.

    Delzhand on
  • bowenbowen Sup? Registered User regular
    edited December 2010
    Probably the better of the two options. You can do what you want, just by finding the next two months and finding out what the last day of the 2nd month is.

    http://stackoverflow.com/questions/1777384/how-to-find-first-day-of-the-next-month-and-remain-days-to-this-date-with-php

    That might be helpful to you.

    bowen on
    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Sign In or Register to comment.