How to Convert text to Datetime

Hi all,

I have one datetime property but it is coming text format from db,you can see below;

x=16102022000000 text property but i want to convert datetime format like this x=20200519T210000.000 GMT .

I tried some functions but i didnt resolve this case.I am waiting your helps.

Thank you!

@Baris_ERENLER Did you give this a try Convert milliseconds to a date | Support Center

@Baris_ERENLER

If the above solution doesn’t work then try with below Java code:

 long unix_seconds = {input unix time stamp};
   //convert seconds to milliseconds
   Date date = new Date(unix_seconds*1000L); 
   // format of the date
   SimpleDateFormat jdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); {provide GMT format here}
   jdf.setTimeZone(TimeZone.getTimeZone("GMT-4"));
   String java_date = jdf.format(date);
return java_Date;

Note: In the library please include java.text.* to access SimpleDateFormat

Thanks,

Vinay

Hi All,

I solved this case like this;

First of all, I used Set Property component on the canvas,I equaled the text format to the datetime.After,I used this function;

datetime property=@addCalendar(@ConvertStringToDateTime(Primary.Date,“ddMMyyyyHHmmss”),0,-1,0,0,3,0,0)

Thank you for your supports!