在Android上通过Shell设置日期 [英] Set the date from a shell on Android

查看:121
本文介绍了在Android上通过Shell设置日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于调试目的,我希望在特定日期运行我的应用.当然,我可以在模拟器上手动更改日期,但是我想知道是否有一种简单的方法可以从模拟器外壳中进行操作(我知道不能通过UI进行操作).

For debugging purposes, I would like to run my app on a certain date. I can change the date manually on my emulator, of course, but I was wondering if there was a simple way to do it from the emulator shell (I know it can't be done from the UI).

推荐答案

按照

Passing seconds-since-epoch as per previous answer didn't work on my instance (WinXP Android SDK11 HVGA_1.6 emulator). However this particular format worked:

adb shell date -s "yyyymmdd.[[[hh]mm]ss]"

[2011年6月27日添加了语法的时间部分.]

这篇关于在Android上通过Shell设置日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆