I am not sure if this is the best way to solve this problem.
Temporarily, I have to decide as shown below.
which calculates different times (for example: +6: 30) programmatically and adds to the date string.
Example Date Line: 2015-11-17 15:30:30 +6:30.
String sdfSt = "2015-11-17 15:30:30";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date sdfDate = format.parse(sdfSt);
System.out.println("Date 1 " + format.format(sdfDate));
Yaml yaml = new Yaml();
String itmeDiff = "+6:30"; --> for my timezone
Date yamlDate = (Date) yaml.load(sdfSt + itmeDiff);
System.out.println("Date 2 " + format.format(yamlDate));
Exit
Date 1 2015-11-17 15:30:30
Date 2 2015-11-17 15:30:30
source
share