在以下文字中:
text\n\nWhy';
Run Code Online (Sandbox Code Playgroud)
我试图摆脱\(包括符号)后的所有内容,以便我的输出将是:text
我该怎么做?尝试:
var s = 'text\n\nWhy';
s = s.substring(0, s.indexOf('\'));
console.log (s)
Run Code Online (Sandbox Code Playgroud) 我需要将当前日期与开始日期进行比较,想法是每个月+ 1天它将返回,好像只有一个月过去了.因此,如果开始日期是2014-10-27,那么在2014-11-27它仍将显示不到一个月前,并且在2014-11-28它将显示一个多月前.
目前我有:
$start_datetime = '2014-10-27';
// true if my_date is more than a month ago
if (strtotime($start_datetime) < strtotime('1 month ago')){
echo ("More than a month ago...");
} else {
echo ("Less than a month ago...");
}
Run Code Online (Sandbox Code Playgroud)