我希望得到一个当前时间戳对象,即分钟l。如何使用JavaScript进行此操作?
这是我的代码:
.getText()
HTML:
var mins = "";
var new_timestamp = parseInt($("#current_time").data("timestamp")) + 1000;
var date = new Date(new_timestamp);
for (var b = 0; b < 60; b++) {
if (b == date.getMinutes()) {
str += "<option selected>" + (b < 10 ? ("0" + b) : b) + "</option>";
} else {
str += "<option>" + (b < 10 ? ("0" + b) : b) + "</option>";
}
}
$("#bank-order-time [name=\"minutes\"]").html(mins);
答案 0 :(得分:0)
var date = new Date();&#xA;
&#xA;&#xA; new Date()
为您提供当时的Date对象。您无需输入时间戳。
并且 date.getMinutes()
为您提供您已知的分钟。
如果您需要再次获取当前时间,请记住您需要创建一个新的Date对象,而不要使用旧的。
&#xA;答案 1 :(得分:0)
我的回答:
string items3 = "4321";
bool sorted3 = Enumerable.SequenceEqual(items3.OrderBy(x => x), items3) || Enumerable.SequenceEqual(items3.OrderByDescending(x => x), items3);