对于每个电子邮件主题,我正在使用.getLastMessageDate()
并生成一个类似于[Mon Nov 14 05:58:24 GMT+08:00 2016, Thu Nov 17 07:46:01 GMT+08:00 2016, Tue Sep 27 07:00:06 GMT+08:00 2016, Wed Sep 07 10:46:50 GMT+08:00 2016, Sun Jul 31 18:47:16 GMT+08:00 2016, Sat Jul 09 06:14:15 GMT+08:00 2016, Sun Apr 24 20:33:50 GMT+08:00 2016, Sun Apr 03 11:48:40 GMT+08:00 2016, Thu Mar 31 12:55:39 GMT+08:00 2016, Wed Mar 23 06:59:00 GMT+08:00 2016]
的数组
我的问题是如何弄清楚最新日期是什么?这在Python中很容易,但我认为在这种情况下,每个元素都是一个字符串。
答案 0 :(得分:1)
怎么样:
.progress-bar {
background-color: green;
}
答案 1 :(得分:0)
您可以按如下方式对日期进行排序:
var dates = [
"Mon Nov 14 05:58:24 GMT+08:00 2016",
"Thu Nov 17 07:46:01 GMT+08:00 2016",
"Tue Sep 27 07:00:06 GMT+08:00 2016",
"Wed Sep 07 10:46:50 GMT+08:00 2016",
"Sun Jul 31 18:47:16 GMT+08:00 2016",
"Sat Jul 09 06:14:15 GMT+08:00 2016",
"Sun Apr 24 20:33:50 GMT+08:00 2016",
"Sun Apr 03 11:48:40 GMT+08:00 2016",
"Thu Mar 31 12:55:39 GMT+08:00 2016",
"Wed Mar 23 06:59:00 GMT+08:00 2016"
];
dates.sort(function(a, b) {
return new Date(b) - new Date(a);
});
alert(dates[0]);