Now it’s like this, I have a long variable with date and time on it. So I use DateFormat to get the date and time for itself, and now I want to get the year, month, day, hour and minutes for itself. The date and time is in a String, so actually I could just cut the string with substring and all that. But since like for example Sweden has their date like this: “dd/mm/yyyy”, and the US has their date like this: “mm/dd/yyyy”. So if I just cut the String for the Swedish date, the day variable will become the month.
This is my code:
String start = mCursor.getLong(1);
Format df = DateFormat.getDateFormat(this);
Format tf = DateFormat.getTimeFormat(this);
String date = df.format(start);
String time = tf.format(start);
So my question is, is there someway to get the year, month, day, hour and minute for itself in a own String?
Thanks in advance, GuiceU. (Bad english, I know)
I wouldn’t do it that way. Use
java.util.Calendar: