Date and Time - php Form

Author Topic: Date and Time  (Read 3506 times)

Offline admin

  • Administrator
  • *****
  • Posts: 67
  • Karma: +10/-0
  • Gender: Male
    • View Profile
Date and Time
« on: August 27, 2007, 01:23:59 AM »


Code: [Select]
<?php
echo(date("F Y h:i:s A"));
?>

Output:

Quote
July 2007 09:41:36 PM
« Last Edit: May 25, 2008, 04:48:11 PM by admin »

Offline alex

  • Global Moderator
  • *****
  • Posts: 77
  • Karma: +19/-0
    • View Profile
Re: Date and Time
« Reply #1 on: August 27, 2007, 01:28:51 AM »
Code: [Select]
<?php
echo(date("l dS F Y h:i:s A"));
?>

Output:

Quote
Saturday 07th July 2007 09:58:32 PM
« Last Edit: May 25, 2008, 04:50:11 PM by admin »

Offline GGGRR1

  • Supporter
  • **
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Date and Time
« Reply #2 on: May 06, 2010, 09:25:59 PM »
Hi
How to change/display or recalculate a US Unix server date/time to Australian EST time?

Got some running stats - cant seem to figure how to add +10 GMT and adjust for daylight saving as well.

The server is between 16 and 19 behind Australian time.


Offline coin

  • Supporter
  • **
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Date and Time
« Reply #3 on: May 07, 2010, 03:41:48 AM »
Code: [Select]
<?php
$date_at_timezone 
= new DateTimeZone('Europe/London');
$date_at_timezone2 = new DateTimeZone('Europe/Belgrade');
$date_at_timezone3 = new DateTimeZone('Australia/Queensland');
$date_at_timezone4 = new DateTimeZone('Australia/Sydney');  
$date = new DateTime(); 
$date->setTimezone($date_at_timezone);
echo 
$date->format('l dS F Y h:i:s A') . " London<br>";
$date->setTimezone($date_at_timezone2);
echo 
$date->format('l dS F Y h:i:s A') . " Belgrade<br>";
$date->setTimezone($date_at_timezone3); 
echo 
$date->format('l dS F Y h:i:s A') . " Queensland<br>";
$date->setTimezone($date_at_timezone4); 
echo 
$date->format('l dS F Y h:i:s A') . " Sydney<br>";
?>