The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled PHP Code
Posted by: chris | May 3, 2011 @ 7:49am
PHP Code
[
Download
]
global $user; $user_timezone_name = date_default_timezone_name(TRUE); $user_timezone = date_default_timezone(TRUE); // Convert the user entered date into a PHP 5 DateTime object $local_date = new DateTime($text_date); // Reformat the user entered date into an ISO date that date_make_date() will accept $iso_date_string = date_format_date($local_date, 'custom', 'Y-m-d\TH:i:s'); // Create a DateTime object with the user's timezone info $utc_date = date_make_date($iso_date_string, $user_timezone_name, DATE_DATETIME); // Change the timezone to UTC date_timezone_set($utc_date, timezone_open('UTC')); // Format the UTC version of the DateTime for use in node->save() $utc_date_string = date_format_date($utc_date, 'custom', 'Y-m-d\TH:i:s'); return $utc_date_string;
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.61 / 8
33 Votes
http://codebin.yi.org/1248
page generated in 0.00 seconds