Convert DateTime SQLite to GMT DateTime SQLite
static public String convertDateTimeToGMT(String in)
{
String out = in;
SimpleDateFormat sdf = new SimpleDateFormat(Utility.getDBDateFormat());
Date iDate = null;
try {
iDate = sdf.parse(in);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
return in;
}
long newd = iDate.getTime() - sdf.getTimeZone().getRawOffset();
SimpleDateFormat osdf = new SimpleDateFormat(Utility.getDBDateFormat());
out = osdf.format(new Date(newd));
return out;
}
Comments
Post a Comment