Forum Discussion

suvidhshetty's avatar
suvidhshetty
Contributor
10 years ago

how to get date and time from android device directly

I need a way to get the date and time from the device directly.

Please help me out.

 

Thanks!

  • You can get the date using the shell date command:

     

    // JScript
    var strDate = Mobile.Device("emulator-5554").ShellExecute("date");
    Log.Message(strDate);
    
    /*
    Output:
    
    Fri Sep  4 13:30:45 GMT 2015
    */
  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    You can get the date using the shell date command:

     

    // JScript
    var strDate = Mobile.Device("emulator-5554").ShellExecute("date");
    Log.Message(strDate);
    
    /*
    Output:
    
    Fri Sep  4 13:30:45 GMT 2015
    */