0

Hi
I have a code in java to generate a sitemap xml, and to get the last modified date using the following line of code:
oPrint.println(" <lastmod>"+ doc.getLastModified().toString()+"</lastmod>");

The output in the browser when calling the xml file is <lastmod>23/05/2014 16:48:24 ZE4</lastmod> which is in "dd/mm/yyyy"format.

However, from this link, https://support.google.com/webmasters/answer/183668?hl=en#183668, it states that the format has to be in YYYY-MM-DD format.

How can I convert my current output to the Google one?

3
Contributors
4
Replies
14
Views
2 Years
Discussion Span
Last Post by Ritesh_4
Featured Replies
  • 1

    these links are worth looking at: [DateFormat api](http://docs.oracle.com/javase/7/docs/api/java/text/DateFormat.html) [SimpleDateFormat api](http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html) [SimpleDateFormat examples 1](http://www.javablogging.com/java-simpledateformat-examples/) [SimpleDateFormat examples 2](http://stackoverflow.com/questions/5580965/java-date-formatter) Read More

0

Addon:
Based on the above code, 05/05/2014 08:43:08 ZE4, how can I get it in the Google format, that is YYYY-MM-DDThh:mm:ssTZD

0

Thnks for the links stultuske, I was actually having problems to resolve the TimeZone from my initial string to convert to the new one, since I did not know what the ZE4 was standing for (since it was generated automatically), but found the solution in the end.

Edited by Ritesh_4

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.