I just created sample BB app, which can allow to choose the date.
DateField curDateFld = new DateField(\"Choose Date: \",
System.currentTimeMillis(), DateF
See the reference documentation for the String class: String s = String.valueOf(date);
If your Long might be null and you don't want to get a 4-letter "null"
string, you might use Objects.toString, like: String s = Objects.toString(date, null);
EDIT:
You reverse it using Long l = Long.valueOf(s);
but in this direction you need to catch NumberFormatException
String longString = new String(""+long);
or
String longString = new Long(datelong).toString();
Just do this:
String strLong = Long.toString(longNumber);
String logStringVal= date+"";
Can convert the long into string object, cool shortcut for converting into string...but use of String.valueOf(date);
is advisable
1.
long date = curDateFld.getDate();
//convert long to string
String str = String.valueOf(date);
//convert string to long
date = Long.valueOf(str);
2.
//convert long to string just concat long with empty string
String str = ""+date;
//convert string to long
date = Long.valueOf(str);
Long.toString()
The following should work :
long myLong = 1234567890123L;
String myString = Long.toString(myLong);