<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic I want to parse created date to date format in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/i-want-to-parse-created-date-to-date-format/m-p/143751#M38174</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;i want to parse created date to time format but it is throwing error.&lt;/P&gt;&lt;P&gt;my created date of document is:-&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Mon May 03 11:58:44 BST 2021&lt;/PRE&gt;&lt;P&gt;i am trying to parse this into date format but it is throwing error:-&lt;/P&gt;&lt;PRE&gt;String createdDate = props.get(ContentModel.PROP_CREATED).toString();
 Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse(createdDate);&lt;/PRE&gt;&lt;P&gt;i want output as:- 2021-05-03 11:58:44 for the created date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone guide how i can acheive it.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Piyush&lt;/P&gt;</description>
    <pubDate>Mon, 03 May 2021 11:20:02 GMT</pubDate>
    <dc:creator>piyush48</dc:creator>
    <dc:date>2021-05-03T11:20:02Z</dc:date>
    <item>
      <title>I want to parse created date to date format</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/i-want-to-parse-created-date-to-date-format/m-p/143751#M38174</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;i want to parse created date to time format but it is throwing error.&lt;/P&gt;&lt;P&gt;my created date of document is:-&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Mon May 03 11:58:44 BST 2021&lt;/PRE&gt;&lt;P&gt;i am trying to parse this into date format but it is throwing error:-&lt;/P&gt;&lt;PRE&gt;String createdDate = props.get(ContentModel.PROP_CREATED).toString();
 Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse(createdDate);&lt;/PRE&gt;&lt;P&gt;i want output as:- 2021-05-03 11:58:44 for the created date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone guide how i can acheive it.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Piyush&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 11:20:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/i-want-to-parse-created-date-to-date-format/m-p/143751#M38174</guid>
      <dc:creator>piyush48</dc:creator>
      <dc:date>2021-05-03T11:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: I want to parse created date to date format</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/i-want-to-parse-created-date-to-date-format/m-p/143752#M38175</link>
      <description>&lt;P&gt;This is not a question related to alfresco specifically and rather a simple java date format stuff, you could search google and do some research on this instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you have asked, this is the input date format that you get from properties:&amp;nbsp;"EEE MMM d HH:mm:ss Z yyyy"&lt;/P&gt;
&lt;P&gt;This is the output format you are looking for:&amp;nbsp; "yyyy-MM-dd'T'HH:mm:ss.SSS"&lt;/P&gt;
&lt;P&gt;So for your input "Mon May 03 11:58:44 BST 2021" date the output would be: "2021-05-03T06:58:44.000" as per the output format you have mentioned.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the sample code :&lt;/P&gt;

&lt;PRE&gt;final DateFormat dateFormatsrc=new SimpleDateFormat("EEE MMM d HH:mm:ss Z yyyy");
final Date sourceDate = (Date) dateFormatSrc.parse("Mon May 03 11:58:44 BST 2021");
final DateFormat dateFormatTarget = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
final String outputDate = dateFormatTarget.format(sourceDate);&lt;BR /&gt;System.out.println("Output: "+ outputDate);&lt;BR /&gt;&lt;BR /&gt;Output: 2021-05-03T06:58:44.000&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 May 2021 15:44:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/i-want-to-parse-created-date-to-date-format/m-p/143752#M38175</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2021-05-03T15:44:28Z</dc:date>
    </item>
  </channel>
</rss>

