web stats
Convert Date with "T" - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-08-2017, 08:07 AM
cldparisi cldparisi is offline
Mirth Newb
 
Join Date: Oct 2017
Posts: 6
cldparisi is on a distinguished road
Default Convert Date with "T"

I haven't problem to convert
"2017-11-08T00:00:00"
to
"20171108"
I use
DateUtil.convertDate('yyyy-MM-dd HH:mm:ss', 'yyyyMMdd', date);

But I have to Convert a date in string format
"2017-11-08T00:00:00"
to
"20171108"

and I have some errors:
- DateUtil.convertDate('yyyy-MM-ddTHH:mm:ss', 'yyyyMMdd', $('PatientBirthDate'));
DETAILS: Wrapped java.lang.IllegalArgumentException: Illegal pattern character 'T'

- DateUtil.convertDate('yyyy-MM-dd?HH:mm:ss', 'yyyyMMdd', $('PatientBirthDate'));
DETAILS: Wrapped java.text.ParseException: Unparseable date: "1974-07-07T00:00:00"

- DateUtil.convertDate('yyyy-MM-dd/^[A-Z]$/HH:mm:ss', 'yyyyMMdd', $('PatientBirthDate'));
DETAILS: Wrapped java.lang.IllegalArgumentException: Illegal pattern character 'A'

- DateUtil.convertDate('yyyy-MM-dd[A-Z]HH:mm:ss', 'yyyyMMdd', $('PatientBirthDate'));
DETAILS: Wrapped java.lang.IllegalArgumentException: Illegal pattern character 'A'

(Ok before I use DateUtil.convertDate I can replace in my date 'T' with space but I want use right pattern in DateUtil.convertDate)
Reply With Quote
  #2  
Old 11-09-2017, 11:16 AM
odo odo is offline
OBX.3 Kenobi
 
Join Date: Feb 2017
Location: Luxembourg
Posts: 165
odo is on a distinguished road
Default

Quote:
Originally Posted by cldparisi View Post
(Ok before I use DateUtil.convertDate I can replace in my date 'T' with space but I want use right pattern in DateUtil.convertDate)
As you virtually wrote in your question, the answer is:
Code:
DateUtil.convertDate('yyyy-MM-dd'T'HH:mm:ss', 'yyyyMMdd', date);
Reply With Quote
Reply

Tags
convertdate, date, datetime, dateutil, timezone

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 07:12 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation