DATETIME.GETTIMEZONE(3) 1 DATETIME.GETTIMEZONE(3)DateTime::getTimezone - Return time zone relative to given DateTime
Object oriented style
SYNOPSIS
public DateTimeZone DateTime::getTimezone (void )
DESCRIPTION
DateTimeZone DateTimeImmutable::getTimezone (void ) DateTimeZone DateTimeInterface::getTimezone (void )
Procedural style
DateTimeZone date_timezone_get (DateTimeInterface $object)
Return time zone relative to given DateTime.
PARAMETERS
o $object
-Procedural style only: A DateTime object returned by date_create(3)RETURN VALUES
Returns a DateTimeZone object on success or FALSE on failure.
EXAMPLES
Example #1
DateTime.getTimezone(3) example
Object oriented style
<?php
$date = new DateTime(null, new DateTimeZone('Europe/London'));
$tz = $date->getTimezone();
echo $tz->getName();
?>
Procedural style
<?php
$date = date_create(null, timezone_open('Europe/London'));
$tz = date_timezone_get($date);
echo timezone_name_get($tz);
?>
The above examples will output:
Europe/London
SEE ALSO DateTime.setTimezone(3).
PHP Documentation Group DATETIME.GETTIMEZONE(3)
Check Out this Related Man Page
DATETIME.SETTIMEZONE(3) 1 DATETIME.SETTIMEZONE(3)DateTime::setTimezone - Sets the time zone for the DateTime object
Object oriented style
SYNOPSIS
public DateTime DateTime::setTimezone (DateTimeZone $timezone)
DESCRIPTION
Procedural style
DateTime date_timezone_set (DateTime $object, DateTimeZone $timezone)
Sets a new timezone for a DateTime object.
PARAMETERS
o $object
-Procedural style only: A DateTime object returned by date_create(3). The function modifies this object.
o $timezone
- A DateTimeZone object representing the desired time zone.
RETURN VALUES
Returns the DateTime object for method chaining or FALSE on failure.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.0 | |
| | |
| | Changed the return value on success from NULL to |
| | DateTime. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
DateTime.setTimeZone(3) example
Object oriented style
<?php
$date = new DateTime('2000-01-01', new DateTimeZone('Pacific/Nauru'));
echo $date->format('Y-m-d H:i:sP') . "
";
$date->setTimezone(new DateTimeZone('Pacific/Chatham'));
echo $date->format('Y-m-d H:i:sP') . "
";
?>
Procedural style
<?php
$date = date_create('2000-01-01', timezone_open('Pacific/Nauru'));
echo date_format($date, 'Y-m-d H:i:sP') . "
";
date_timezone_set($date, timezone_open('Pacific/Chatham'));
echo date_format($date, 'Y-m-d H:i:sP') . "
";
?>
The above examples will output:
2000-01-01 00:00:00+12:00
2000-01-01 01:45:00+13:45
SEE ALSO DateTime.getTimezone(3), DateTimeZone.__construct(3).
PHP Documentation Group DATETIME.SETTIMEZONE(3)
hello everyone. im sure someone has run into the problem of timestamping files and end up haveing 2 files with the same name thus over writeing one of them.
In my application i am trying to get a timestamp w/ milliseconds but i am haveing no luck and finding an answer in the man pages.
I know... (3 Replies)
Discussion started by: Optimus_P
3 Replies
2. Forum Support Area for Unregistered Users & Account Problems
Hi,
I am hoping that someone could please be of assistance.
I am living in London and was told that in order to catch up with some friends in South africa who talk on Lagnet, I could do it through this site.
I have absolutely NO idea how.
Could someone please assist me by telling me... (2 Replies)
Here is my code:
DATETIME=1214163003
echo $DATETIME | sed 's/....//' | sed 's/....$//' | read DATEHOUR
echo $DATETIME | sed 's/......//' | sed 's/..$//' | read DATEMIN
echo $DATEHOUR
echo $DATEMIN
The idea is that i need the 16 stored in DATEHOUR and the 30 stored in DATEMIN but when... (4 Replies)
i have this script
#!/bin/sh
for i in Europe/Dublin Europe/Berlin US/Eastern US/Central US/Mountain US/Pacific
do
export TZ=$i
case $1 in
"") echo "`date` $i";;
*) echo "`date` $i" | grep $1;;
esac
done
how would i turn the time into the stand 12 hour time? (1 Reply)
i am reading an i/p file input.txt as below and want to read all filenames as in highlighted in bold below and put them in a different file output.txt. can someone help me with a shell script to do this? thanks in advance
regards
brad
input.txt
---------
START
TYPE:OPT
INIT_SEQ:01... (8 Replies)
hi guys,
i have script like below:
if
then
DATETIME=${1}
fi
pls can anyone explain what does ${1} means? what if i have i have two arguments and have {2} added to the if cond? any links to get this claruified on the syntax? (4 Replies)
input:
ref001, Europe, Belgium, 1001
ref001, Europe, Spain, 203
ref001, Europe, Germany, 457
ref002, America, Canada, 234
ref002, America, US, 87
ref002, America, Alaska, 652
Without using an END section, I need to write all the info related to the same ref number ($1)and continent ($2) on... (9 Replies)
Discussion started by: lucasvs
9 Replies
9. Post Here to Contact Site Administrators and Moderators