How to convert Date to DateTime format


How to convert the date string to DateTime format

please find the below example


Date1=  20160427

Date2=20160423T040000.000 GMT

I need to convert Date1 format to Date2 format.

Please suggest me how to achive this.



**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Correct Answer
April 20, 2016 - 1:56pm

Hi Pramod,

I am not sure if this is of any help to you but do check this OOTB RUF



Keep up to date on this post and subscribe to comments

April 20, 2016 - 12:25pm

Many versions of Pega ship with Joda Time included: Joda-Time - Home

You can initialize a Joda DateTime (DateTime (Joda time 2.2 API))  using your input format:, and use a Joda DateTimeFormatter (DateTimeFormatter (Joda time 2.2 API)) to print out the date in your desired format which you construct using a DateTimeFormat object (DateTimeFormat (Joda time 2.2 API)).

Due to your input format not adhering to a standard that joda understands, you MUST get your DateTime object this way:

org.joda.time.DateTime dt = org.joda.time.format.DateTimeFormat.forPattern("YYYYMMdd").parseDateTime(inputStr);

April 20, 2016 - 1:34pm

Hi Pramod,

I am not sure if this is of any help to you but do check this OOTB RUF


April 21, 2016 - 9:56am
Response to Prakash.

Thanks Bhanu. your OOTB logic working fine

December 8, 2016 - 7:45am

n oracle SQL - PRPC_READ_FROM_STREAM() function I am getting values in this format "yyyyMMddtHHmmss.SSS zzz". how to convert this into YYYY-DD-MM HH:MI:SS in oracle sql.

January 31, 2017 - 9:03pm

@DateTime.addToDate(Param.InputDate,0,0,0,0) is working Thanks Prakash