Super Web Mart - Discount Coupons & Deals - Discount Promos, Coupon Codes, Discount deals and web site reviews
 

Poll

PHP date time.

a
0 (0%)
b
0 (0%)

Total Members Voted: 0

Author Topic: PHP date time.  (Read 1003 times)

0 Members and 1 Guest are viewing this topic.

Offline Solushunz

  • Full Member
  • ***
  • Posts: 130
    • View Profile
PHP date time.
« on: June 25, 2011, 12:52:18 AM »
i am new in php but i have created the below code on my webpage to show the date, but its not working. i want to see a simple format of date and time.want to know why?

<?php
date_default_timezone_set('UTC');
echo date("l");
echo date('l jS \of F Y h:i:s A');
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));
echo date("DATE");
echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));
?>


« Last Edit: June 25, 2011, 11:18:42 PM by seochapter »

Webmaster Forum

PHP date time.
« on: June 25, 2011, 12:52:18 AM »

Offline jbard

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • Web Partner Group
Re: PHP date time.
« Reply #1 on: December 27, 2011, 10:06:21 PM »
Object oriented style-
<?php
$date = new DateTime('2000-01-01');
echo $date->format('Y-m-d H:i:s');
?>

Procedural style
<?php
$date = date_create('2000-01-01');
echo date_format($date, 'Y-m-d H:i:s');
?>


Webmaster Forum

Re: PHP date time.
« Reply #1 on: December 27, 2011, 10:06:21 PM »