2017-10-17 155 views
3

我正在進行一個項目(Android application使用Apache Cordova HTML CSS JS)。
我想要得到device current time and date

Cordova:Android設備當前日期/時間

我檢查了所有的問題,但都沒有給我一個解決方案。有人可以幫忙嗎?謝謝。

回答

1

下面的代碼演示瞭如何獲取日期時間試試這個

var currentdate = new Date(); 
var datetime = currentdate.getDate() + "/" 
       + (currentdate.getMonth()+1) + "/" 
       + currentdate.getFullYear() + " @ " 
       + currentdate.getHours() + ":" 
       + currentdate.getMinutes() + ":" 
       + currentdate.getSeconds();