I am developing an application which will check the last modified time of a file from google drive and last modified time of file on local machine, and compare them, if file on the local machine is found to be latest modified then it will be uploaded or else file from cloud will be uploaded. I have upload down load code. I have file last modified time of the local file and also of the google drive file but the problem is the DateTime which is returned from google drive on calling this function lastModTimeCloudFile = f.getModifiedByMeDate();
it returns DateTime which is of Google api. Now I want to convert it to java.util.Date format how can I do it. Please help me all the experts out their.
Here's what I have tried.
for (File f : result) {
String ext = null;
fileName = f.getTitle();
if (fileName.equals("IDPWD")) {
nFlagIfFile = 1;
lastModTimeLocalFile = new Date(dbFile.lastModified());
localModTime = formatter.format(lastModTimeLocalFile);
java.util.Date date ;
lastModTimeCloudFile = f.getModifiedByMeDate();
try {
date = formatter.parse(lastModTimeCloudFile.toString());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
This gives error
java.text.ParseException: Unparseable date: "2013-12-27T11:15:10.382Z"
at java.text.DateFormat.parse(Unknown Source)
at GetNewFile.main(GetNewFile.java:89)
How can I do it. Please point me to right direction.
Thanks in advance.