unexpecting result with my code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amrhi
    New Member
    • Sep 2006
    • 22

    #1

    unexpecting result with my code

    what's wrong with mycode i cant get what i hope appears
    thanks to help me
    [PHP]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitl ed Document</title>
    </head>
    <?php
    $date="20";
    $month="02";
    $year="2007";
    $dt="$year$mont h$date";
    $t1=date($dt);
    $t2=date("d",$t 1);
    $t3=date("F",$t 1);
    $t4=date("Y",$t 1);
    echo"$t2";
    echo"$t3";
    echo"$t4";
    //attempt to get 20 February 2007
    ?>
    <body>
    </body>
    </html>[/PHP]
  • cassbiz
    New Member
    • Oct 2006
    • 202

    #2
    Try this snippet

    Code:
    <?php
    
    $date="20";
    $month="2";
    $year="2007";
    
    $timestamp = mktime(0,0,0, $month, $date, $year);
    
    //attempt to get 20 February 2007
    echo date('d F Y', $timestamp);
    
    ?>
    Good Luck with your project

    Comment

    • amrhi
      New Member
      • Sep 2006
      • 22

      #3
      thanks it works

      Comment

      Working...