getting month and year from a date

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • laredotornado@zipmail.com

    getting month and year from a date

    Hello,

    Using PHP 4, how would i Extract the numeric month and year from a date
    variable created using the date() function?

    Thanks, - Dave

  • Janwillem Borleffs

    #2
    Re: getting month and year from a date

    laredotornado@z ipmail.com wrote:[color=blue]
    > Using PHP 4, how would i Extract the numeric month and year from a
    > date variable created using the date() function?
    >[/color]

    With date:
    list($year, $month) = explode('-', date('Y-n'));

    With getdate:
    $date = getdate();
    $year = $date['year'];
    $month = $date['mon'];


    JW


    Comment

    Working...