查看: 956|回复: 2
|
J2ME CLDC 1.0 Date 变成 String
[复制链接]
|
|
在 J2ME CLDC 1.1 里,要将 Date 变成 String 可以这样做:
long lDateInLong = <some date value in miliseconds>;
Date date = new Date(lDateInLong);
String strDate = date.toString(); //Get date in String with format: dow mon dd hh:mm:ss zzz yyyy
但是 在 J2ME CLDC 1.0 里,Date 却没有 toString() 这个 method, 请问有谁知道 alternative way 来 get date in String 吗? |
|
|
|
|
|
|
|

楼主 |
发表于 3-3-2006 09:57 AM
|
显示全部楼层
SotongJiang 谢谢您。其实在您回复之前,我已经找到 solution,也就是好像以上您提供的方法一样,用 Calendar。
可是当我把 它放进 Nokia 6600 test 时,却发现到一个问题,如果在 Nokia 6600 里,并没有 set TimeZone, 也就是,GMT 是 set as GMT +00.00 时,它就会 throw exception.
But my J2ME application cannot force user to set TimeZone in the phone, hence how to tacle with this? |
|
|
|
|
|
|
|

楼主 |
发表于 3-3-2006 02:37 PM
|
显示全部楼层
yah.. i think i have to give up on finding a solution for this (when timeZone not set in handset). Anyway.. thanks for ur helps |
|
|
|
|
|
|
| |
本周最热论坛帖子
|