Jump to content

Not quite sure how to work this out..


Scooby08

Recommended Posts

Not quite sure how to explain, but I added this:

 

strtotime($myTime)

 

to this:

 

return date('F jS Y, g:i A',strtotime($myTime));

 

Can the same be done to this some how??

 

return = date('F jS Y - g:i A', mktime($time / 60, $time % 60, 0, gmdate('m'), gmdate('d'), gmdate('Y'))) . " $timezone_code";

 

 

Link to comment
https://forums.phpfreaks.com/topic/125578-not-quite-sure-how-to-work-this-out/
Share on other sites

I'm trying to incorporate it into this function:

 

<?php
function GetMyTime($input_location_id,$myTime)
{
global $dst;

/* Check for valid location ID, return 0 date if invalid */
	if ($input_location_id > 0)
	{
		$result = mysql_query("SELECT timezoneid, gmt_offset, dst_offset, timezone_code FROM dw_timezone WHERE timezoneid = '$input_location_id'");
		list($timezoneid, $gmt_offset, $dst_offset, $timezone_code) = mysql_fetch_array($result);
	}
	else
	/*	This is the default date returned upon first accessing the page */
		return date('F jS Y, g:i A',strtotime($myTime));

	if ($dst_offset > 0)
	{
		if (!($dst))
		{
		/*	Set the DST offset to zero if the box is not checked
			and append the standard time acronym to the timezone code */
			$dst_offset = 0;
			$timezone_code = getTimeZoneCode($timezone_code, $gmt_offset + $dst_offset, "ST");
		}
		else if (!isDaylightSaving($timezoneid, $gmt_offset))
		{
		/*	Set the DST offset to zero if the timezone is not currently
			in DST and append the standard time acronym to the timezone code */
			$dst_offset = 0;
			$timezone_code = getTimeZoneCode($timezone_code, $gmt_offset + $dst_offset, "ST");
		}
		else if ($timezone_code != '')
		/*	Leave the DST offset and append the daylight saving time acronym
			to the timezone code */
			$timezone_code = getTimeZoneCode($timezone_code, $gmt_offset + $dst_offset, "DT");
		else
		/*	Assign a timezone code */
			$timezone_code = getTimeZoneCode($timezone_code, $gmt_offset + $dst_offset, "");
	}
/*	Does not observe DST at all */
	else
		$timezone_code = getTimeZoneCode($timezone_code, $gmt_offset + $dst_offset, "ST");

/* Get the DST offset in minutes */
	$dst_offset *= 60;
/* Get the GMT offset in minutes */
	$gmt_offset *= 60;
	$gmt_hour = gmdate('H');
	$gmt_minute = gmdate('i');
/* Calculate the time in the timezone */
	$time = $gmt_hour * 60 + $gmt_minute + $gmt_offset + $dst_offset;

/* Convert time back into hours and minutes when returning */
	return = date('F jS Y - g:i A', mktime($time / 60, $time % 60, 0, gmdate('m'), gmdate('d'), gmdate('Y'))) . " $timezone_code";
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.