佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 956|回复: 2

J2ME CLDC 1.0 Date 变成 String

[复制链接]
发表于 2-3-2006 02:20 PM | 显示全部楼层 |阅读模式
在 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 吗?
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 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
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 7-3-2025 03:27 AM , Processed in 0.178338 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表