var str = '30.10.2015 19:53';
$stamp1 = My::getTimeStamp(str);
static function getTimeStamp($dateFormat)
{
$dateTime = explode(' ',$dateFormat);
$date = $dateTime[0];
$time = $dateTime[1];
$dMY = explode('.',$date);
$hm = explode(':',$time);
$day = $dMY[0];
$month = $dMY[1];
$year = $dMY[2];
$hour = $hm[0];
$minutes = $hm[1];
return mktime($hour, $minutes, 0, $month, $day, $year);
}
var date1 = new Date();
var date2 = new Date('30.10.2015 19:53');
function formatStringToDate(dateString) {
var regex = /(\d{2}).(\d{2}).(\d{4}) (\d{2}):(\d{2})/;
var dateArray = regex.exec(dateString);
var dateObject = new Date(
(+dateArray[3]),
(+dateArray[2])-1,
(+dateArray[1]),
(+dateArray[4]),
(+dateArray[5])
);
return dateObject;
}
var str1 = '30.10.2015 19:53';
var str2 = '26.04.2016 16:23';
var date1 = formatStringToDate(str1);
var date2 = formatStringToDate(str2);
if (date1 > date2) {
alert('date1>date2');
} else if (date2 > date1) {
alert('date1<date2');
} else {
alert('date1=date2');
}