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?

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

Did you look at the links stultuske posted? What specifically about SimpleDateFormat are you having trouble with?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.