if ( is_user_logged_in() ) {
echo 'Юзер авторизировался, можем выводить форму добавления поста.';
}
else {
echo 'Юзер не авторизировался, выводим ссылки на авторизацию и регистрацию.';
}
function timeOf(offset) {
var d, utc, nd;
d = new Date();
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
nd = new Date(utc + (3600000 * offset));
return nd.toLocaleTimeString();
}
var hours, time_arr, hour, work_hours;
hours = timeOf('+3');
time_arr = hours.split(':');
hour = time_arr[0];
work_hours = ["9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"];
if($.inArray(hour, work_hours) !== -1)
$('.test').html("TRUE");
else
$('.test').html("FALSE");
$timestamp = "2016.09.02T13:34";
$today = new DateTime(); // This object represents current date/time
$today->setTime( 0, 0, 0 ); // reset time part, to prevent partial comparison
$match_date = DateTime::createFromFormat( "Y.m.d\\TH:i", $timestamp );
$match_date->setTime( 0, 0, 0 ); // reset time part, to prevent partial comparison
$diff = $today->diff( $match_date );
$diffDays = (integer)$diff->format( "%R%a" ); // Extract days count in interval
switch( $diffDays ) {
case 0:
echo "//Today";
break;
case -1:
echo "//Yesterday";
break;
case +1:
echo "//Tomorrow";
break;
default:
echo "//Sometime";
}
<div class="user-content">
<div class="user">