0

I have dates in following formats

EEEE  MMM dd, yyyy HH:mm aaa
EEE, dd MMM yyyy HH:mm:ss z
EEE, MMMM dd, yyyy, HH:mm aaa z
yyyy-MM-dd-HH-mm
yyyyMMddHHmm
EEEE, MMMM dd, yyyy HH:mm aa
yyyyMMddHHmmssSS
yyyyMMddHHmmss
MM/dd/yyyy HH:mm

I want these dates to be in my local GMT, and convert from one GMT to other GMT dynamically in java. Is there any native java function to this or i have to code it. e.g convert 11/07/2013 12:32pm (MM/dd/yyyy HH:mm) to GMT+5 timezone i mean to say that if my datetime is in GMT-10 timezone, that what will be its value in GMT+5 timezone

Any help will be appreciated. Thanks

Achilles
  • 519
  • 7
  • 27

1 Answers1

0
    private String converttogmt(Date date){
    SimpleDateFormat datef = new SimpleDateFormat("yyyy-MM-dd-HH-mm");
    datef.setTimeZone(TimeZone.getTimeZone("GMT"));
    return datef.format(date);
}

Try this one.