test_1.php 3.74 KB
<?php

$currentDate = strtotime("+24 hours", strtotime(date('Y-m-d H:i:s')));
$currentDate = date('Y-m-d H:i:s', $currentDate);
echo $currentDate."<br/>";

$currentDate = strtotime("-24 hours", strtotime(date('Y-m-d H:i:s')));
$currentDate = date('Y-m-d H:i:s', $currentDate);
echo $currentDate;
exit();

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of test
 *
 * @author Administrator
 */
function renderCouponCode() {
    //date('ymdhis');
    return date('His') . randDomChar(2) . date('ymd');
}

function randDomChar($length = 10) {

    $string = '';
    // You can define your own characters here.
    $characters = "ABCDEFHJKLMNPRTVWXYZabcdefghijklmnopqrstuvwxyz";

    for ($p = 0; $p < $length; $p++) {
        $string .= $characters[mt_rand(0, strlen($characters) - 1)];
    }

    return $string;
}

//echo renderCouponCode()."<br/>";
//$currentDate = strtotime("+3 day", strtotime(date('Y-m-d')));
//$currentDate1 = strtotime(date('Y-m-d'));
echo date('Y-m-d H:i:s') . "<br/>";
$currentDate = strtotime("+6 hours", strtotime(date('Y-m-d H:i:s')));
echo date('Y-m-d H:i:s', $currentDate) . "<br/>";

echo date('Y-m-d', strtotime('2016-05-11 11:18:10')) . "<br/>";
$startDate = '2016-05-11 11:18:10';
$endDate = '2016-05-11 11:20:10';

$startDate = strtotime(date('Y-m-d', strtotime($startDate)));
$endDate = strtotime(date('Y-m-d', strtotime($endDate)));
echo $endDate - $startDate;
/**<span class="tribe-event-date-start">August 3 @ 8:00 am</span>
-
<span class="tribe-event-date-end">August 7 @ 5:00 pm</span>
<div class="recurringinfo"><div class="event-is-recurring"><span class="tribe-events-divider">
/**
 *        $arrayStringTitle = explode('-', str_replace(array('<span class="tribe-event-date-start">', '<span class="tribe-event-date-end">', '</span>'), array('', '', ''), $title));

                    $time1 = '';
                    $time2 = '';
                    $time3 = '';
                    $time4 = '';
                    print_r($arrayStringTitle);
                    if (count($arrayStringTitle) >= 2) {
                        $stringTime1 = (isset($arrayStringTitle[0]) && $arrayStringTitle[0]) ? $arrayStringTitle[0] : '';

                        if ($stringTime1) {
                            $arrayStringTime1 = explode('@', $stringTime1);
                            // print_r($arrayStringTime1);
                            // exit();
                            if (count($arrayStringTime1) == 2) {
                                $time1 = isset($arrayStringTime1[0]) ? $arrayStringTime1[0] : '';
                                $time2 = isset($arrayStringTime1[1]) ? $arrayStringTime1[1] : '';
                                //echo $time1;
                                //exit();
                            }
                        }
                        $stringTime2 = (isset($arrayStringTitle[1]) && $arrayStringTitle[1]) ? $arrayStringTitle[1] : '';
                        if ($stringTime2) {
                            $arrayStringTime2 = explode('@', $stringTime2);
                            if (count($arrayStringTime2) == 2) {
                                $time3 = isset($arrayStringTime2[0]) ? $arrayStringTime2[0] : '';
                                $time4 = isset($arrayStringTime2[1]) ? $arrayStringTime2[1] : '';
                            }
                        }
                    }

                    if ($time1 && $time2 && $time3 && $time4) {
                        $title = '<span class="tribe-event-date-start">' . trim($time1) . " - " . trim($time3) . "</span> @ <span class='tribe-event-date-end'>" . trim($time2) . " - " . trim($time4) . "</span>";
                    }
 */