当前位置: 首页>>代码示例>>PHP>>正文


PHP Game::getDefaultSubscriptionClose方法代码示例

本文整理汇总了PHP中Game::getDefaultSubscriptionClose方法的典型用法代码示例。如果您正苦于以下问题:PHP Game::getDefaultSubscriptionClose方法的具体用法?PHP Game::getDefaultSubscriptionClose怎么用?PHP Game::getDefaultSubscriptionClose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Game的用法示例。


在下文中一共展示了Game::getDefaultSubscriptionClose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: date_default_timezone_get

<?php

require_once 'classes/go_game.class.php';
//get server timezone
$serverTZ = date_default_timezone_get();
//sample date/time - default to New York
$dateSrc = '2010-06-19 12:50';
$timeZone = 'America/New_York';
// +2 hours
$dateTime = new DateTime($dateSrc, new DateTimeZone($timeZone));
echo $dateTime->format("M:d:Y:H:i:s") . "\n";
$newDateTime = Game::getDefaultSubscriptionClose('Date', $dateTime);
echo 'DateTime::format(): ' . $newDateTime->format('M:d:Y:H:i:s');
exit;
function getDefaultSubscriptionClose($typeName, $pivotDateStart, $pivotDateEnd = null)
{
    if (get_class($pivotDateStart) != "DateTime") {
        return null;
    }
    $serverTZ = date_default_timezone_get();
    $pivotDateStart->setTimeZone(new DateTimeZone($serverTZ));
    $timeNow = new DateTime("now", new DateTimeZone($serverTZ));
    $timeNowTMZ = strtotime($timeNow->format("Y-m-dTH:i:s"));
    //convert to int - unix epoch
    $pivotTMZ = strtotime($pivotDateStart->format("Y-m-dTH:i:s"));
    //convert to int - unix epoch
    $diffTMZ = ($pivotTMZ - $timeNowTMZ) / 2;
    //take half of the difference
    $closeDateTMZ = $pivotTMZ - $diffTMZ;
    //calculate defaultCLoseDate in Unix epoch
    $closeDate = date("Y-m-dTH:i:s", $closeDateTMZ);
开发者ID:juliomiy,项目名称:gameon-web,代码行数:31,代码来源:time2.php

示例2: date_default_timezone_get

$serverTZ = date_default_timezone_get();
$serverTZObj = new DateTimeZone($serverTZ);
$gmtTZObj = new DateTimeZone('Europe/London');
$nycTZObj = new DateTimeZone('America/New_York');
$serverDateTime = new DateTime("now", $serverTZObj);
$gmtDateTime = new DateTime("now", $gmtTZObj);
$nycDateTime = new DateTime("now", $nycTZObj);
echo "Class name is " . get_class($nycDateTime) . "\n";
echo "NYC Time = " . $nycDateTime->format('Y-m-d H:i:s') . "\n";
echo "Server Time = " . $serverDateTime->format('Y-m-d H:i:s') . "\n";
echo "GMT Time = " . $gmtDateTime->format('Y-m-d H:i:s') . "\n";
$offset = $serverTZObj->getOffset($nycDateTime);
echo "Offset = {$offset}" . "\n";
//$nycDateTime->add(new DateInterval('P10D'));
$nycDateTime = "2010-06-02";
$d = Game::getDefaultSubscriptionClose('Date', $nycDateTime);
print_r($d);
exit;
//$dd=date_add( $nycDateTime , new DateInterval('P10D' ));
//print_r($dd);
if ($d) {
    echo "NYC Default CLose Time = " . $d->format('Y-m-d H:i:s') . "\n";
}
echo get_class($nycDateTime);
//echo($serverTZObj->getOffset( $serverDateTime));
//echo($nyTZObj->getOffset( $serverDateTime));
exit;
echo "Current time in NYC is " . date("d/m/y : H:i:s", time());
date_default_timezone_set("America/Denver");
echo "Current time after setting in NYC is " . date("d/m/y : H:i:s", time());
echo date_default_timezone_get();
开发者ID:juliomiy,项目名称:gameon-web,代码行数:31,代码来源:time.php

示例3: goUserSettings

$userSettings = new goUserSettings($createdByUserID);
//grab user who created this wager - will need properties for syndication including oauth credentials
header("Content-Type: text/xml");
echo '<?xml version="1.0"?>';
$link = mysqli_connect(Config::getDatabaseServer(), Config::getDatabaseUser(), Config::getDatabasePassword(), Config::getDatabase());
if (!$link) {
    // Server error
    header('HTTP/1.1 500 Internal Server Error');
    mydie("Error connecting to Database");
}
$gameInviteKey = Utility::generateGameInvite('GAMEID');
//if not set or empty, calculare default subscriptionClose date/time
//TODO -currently defaulting to a Wager of type "date" driven -
if (empty($subscriptionClose)) {
    $pivotDateObj = new DateTime($pivotDate, new DateTimeZone('America/New_York'));
    $subscriptionCloseObj = Game::getDefaultSubscriptionClose($typeName, $pivotDateObj);
    if ($subscriptionCloseObj) {
        $subscriptionClose = $subscriptionCloseObj->format("Y-m-d h:i:s");
    }
}
//grab the shortened subscription url for the wager.
//$rc = Utility::shortenUrl("http://jittr.com/jittr/gameon/gogame.php/" . urlencode("?gameid=" . $gameID . "&createdbyuserid=" . $createdByUserID));
//if (Config::getDebug()) $LOG->log("status code " . $rc->status_code,PEAR_LOG_INFO);
//if ($rc->status_code == 200) {
//    $syndicationUrl= $rc->data->url;
//}
$sql = sprintf("insert into go_games (gameID,publicGameID,createdByUserID,createdByUserName,title,eventName,date,description,type,typeName,pivotDate,pivotCondition,sportID,sportName,leagueID,leagueName,closeDateTime,expirationDateTime,syndicationUrl,wagerType,wagerUnits) values ('%s','%u','%u','%s','%s','%s','%s','%s','%u','%s','%s','%s','%s','%s','%s','%u','%s','%s','%s','%s','%u')", mysqli_real_escape_string($link, $gameID), mysqli_real_escape_string($link, $publicGameID), mysqli_real_escape_string($link, $createdByUserID), mysqli_real_escape_string($link, $createdByUserName), mysqli_real_escape_string($link, $title), mysqli_real_escape_string($link, $eventName), mysqli_real_escape_string($link, $eventDateTime), mysqli_real_escape_string($link, $description), mysqli_real_escape_string($link, $type), mysqli_real_escape_string($link, $typeName), mysqli_real_escape_string($link, $pivotDate), mysqli_real_escape_string($link, $pivotCondition), mysqli_real_escape_string($link, $sport), mysqli_real_escape_string($link, $sportName), mysqli_real_escape_string($link, $leagueID), mysqli_real_escape_string($link, $leagueName), mysqli_real_escape_string($link, $subscriptionClose), mysqli_real_escape_string($link, $expirationDateTime), mysqli_real_escape_string($link, $syndicationUrl), mysqli_real_escape_string($link, $wagerType), mysqli_real_escape_string($link, $wagerUnits));
if (Config::getDebug()) {
    $LOG->log("{$sql}", PEAR_LOG_INFO);
}
$rc = mysqli_query($link, $sql);
开发者ID:juliomiy,项目名称:gameon-web,代码行数:31,代码来源:go_postnewgame.php


注:本文中的Game::getDefaultSubscriptionClose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。