Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova : Android device current date/time

I am working on a project (Android application using Apache Cordova HTML CSS JS).
I want to get the device current time and date.

I checked all the questions but none gives me a solution. Can someone help, please? Thanks.

like image 823
Zak-Dev Avatar asked Apr 27 '26 14:04

Zak-Dev


1 Answers

Following code shows how to get datetime try this

var currentdate = new Date(); 
var datetime =  currentdate.getDate() + "/"
                + (currentdate.getMonth()+1)  + "/" 
                + currentdate.getFullYear() + " @ "  
                + currentdate.getHours() + ":"  
                + currentdate.getMinutes() + ":" 
                + currentdate.getSeconds();
like image 81
Nisal Edu Avatar answered Apr 30 '26 04:04

Nisal Edu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!