<?php echo date("Y"); ?>

Discussion in 'HTML & Website Design' started by andrej, Jan 21, 2011.

  1. #1
    Do you know this code?:

    <?php echo date("Y"); ?>

    Does this code load the current year? E.g. 2011?
     
    andrej, Jan 21, 2011 IP
  2. davmillar

    davmillar Peon

    Messages:
    12
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It should load the current year based on the server's date. It can provide a different year if you provide a date as an argument, but the way you've written it should just show the current year.
     
    davmillar, Jan 21, 2011 IP
    andrej likes this.
  3. fdizzley

    fdizzley Guest

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Just make sure PHP is installed to the server displaying the web page. That code is often used for copyright dates.
     
    fdizzley, Jan 21, 2011 IP
    andrej likes this.
  4. xwdfly

    xwdfly Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes.it should load the current year..in date(),you can provide different argument.
     
    xwdfly, Jan 21, 2011 IP
  5. deepakg

    deepakg Peon

    Messages:
    48
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes this code load the current Year and write result also see below with function :

    <?php echo date("y"); ?> Short Year 11
    <?php echo date("Y"); ?> Full year 2011
     
    deepakg, Jan 22, 2011 IP
    andrej likes this.
  6. vineld

    vineld Greenhorn

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #6
    This is PHP, not HTML. You have already been given the answer but here you will find all arguments that can be passed through the date function:

    http://php.net/date
     
    vineld, Jan 22, 2011 IP
  7. fzero17

    fzero17 Active Member

    Messages:
    154
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #7
    thats wordpress codex date if u want date and mont is , D,M,Y
     
    fzero17, Jan 22, 2011 IP