How to get current time of the cellphone in which i am automating the application?

I have a scenario in which I need to get the current time of cell phone in which I am automating my script. Is there any way to do it?

try, driver.getDeviceTime();

Hi @in-ishan ,
I tried driver.getDeviceTime();
but it is giving me an error: “That URL did not map to a valid JSONWP resource”.
This is not working for me. Someone, please provide me any other solution!

Hi Jitender,

I just tried, driver.getDeviceTime() on iOS Simulator and android device and it’s working. My driver object is Android / IOSDriver object

AppiumDriver driver = new AndroidDriver(service.getURL(), capabilities);
AppiumDriver driver = new IOSDriver(service.getURL(), capabilities);

Could you please tell about your driver object?

Hi @in-ishan,

My driver object is:
AndroidDriver driver= new AndroidDriver (new URL(“”), capabilities);

Do I need to make some changes?