www.webdeveloper.com
Results 1 to 3 of 3

Thread: need help for echo or print

Hybrid View

  1. #1
    Join Date
    Sep 2011
    Posts
    21

    need help for echo or print

    the problem is here:
    PHP Code:
    if ($redirect) {     
    header("Location: $redirect"); //missing.php      
    exit;  } else {     
    echo 
    "Thank you, you now have an extended period to: <span style=\"color:#CC0000; font-weight:bold;\">          
    $dateNow = new DateTime();         
    $dateAhead = $dateNow->add(DateInterval::createFromDateString('1 months'));         
    print 
    $dateAhead->format('d F, Y, H:i:s');</span>\n";     
    exit;  } 
    in what other method can get:
    PHP Code:
    $dateNow = new DateTime();         
    $dateAhead $dateNow->add(DateInterval::createFromDateString('1 months'));         
    print 
    $dateAhead->format('d F, Y, H:i:s'); 
    To exit the result:* Thank you, you now have an extended period to: .... show me the result of print $dateAhead->format('d F, Y, H:i:s');?


    when i try:
    PHP Code:
    if ($redirect) { header("Location: $redirect"); 
    exit;  
    } else {     
    $dateNow = new DateTime(); 
    $dateAhead $dateNow->add(DateInterval::createFromDateString('1 months')); 
    $formatted $dateAhead->format('d F, Y, H:i:s'); 
    print 
    "Thank you, you now have an extended period to: <span style=\"color:#CC0000; font-weight:bold;\">$formatted</span>\n";      
    exit;  } 
    It shows:
    Fatal error: Call to undefined method DateTime::add() in

  2. #2
    Join Date
    Sep 2011
    Posts
    21
    php now is 5.3 but:

    Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() [<a href='datetime.--construct'>datetime.--construct</a>]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Helsinki' for 'EEST/3.0/DST' instead' in /home/www/add.php:317 Stack trace: #0 /home/www/add.php(317): DateTime->__construct() #1 {main} thrown in /home/www/add.php on line 317

  3. #3
    Join Date
    Jul 2013
    Posts
    29
    You are *required* to use the date.timezone setting or the date_default_timezone_set() function.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles