Problem in changing String to date in blackberry?
i am using following code but the long values are not same any one can help me .
{
long longCurrentTime=System.currentTimeMillis();
System.out.println("Current time is..."+longCurrentTime);
Date date=new Date(longCurrentTime);
SimpleDateFormat dformat=new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss");
String inStringTime=dformat.format(date);
long byStringLongValue=HttpDateParser.parse(inStringTime);
System.out.println("String to long conversion..."+byStringLongValue);
}
in this code both long values开发者_Python百科 are coming different.
thanks
The reason is that your date format ignores the millisecond
part.
Add the milliseconds part and verify the result.
SimpleDateFormat dformat=new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss S");
^^^^
精彩评论