cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

How to map Thingworx DATETIME to java Date?

ngarad
7-Bedrock

How to map Thingworx DATETIME to java Date?

Hi,

I have created Java extension to create a thing template and services.

One of the service extract Date from Thingworx mashup i.e. DATETIME picker and pass it to sql query eg. "select * from db_table where date between from_date and to_date".

So i created the service and defined parameter as

@ThingworxServiceParameter( name="From_Date", description="From Date", baseType="DATETIME" )  Date from_date

But when i run the service from Thingworx composer i get error as "Cannot cast org.joda.time.DateTime to java.lang.Date"

Can anyone help me here to pass date from mashup to java extension? Also how to convert that date to sql query mentioned above?

I found similar case at PTC support but there is no resolution. Date Issue when passing from one service to another service

Thanks,

Nagnath

ACCEPTED SOLUTION

Accepted Solutions
ngarad
7-Bedrock
(To:ngarad)

Used org.joda.time.DateTime and issue got resolved.

@ThingworxServiceParameter( name="From_Date", description="From Date", baseType="DATETIME" )  DateTime from_date

View solution in original post

1 REPLY 1
ngarad
7-Bedrock
(To:ngarad)

Used org.joda.time.DateTime and issue got resolved.

@ThingworxServiceParameter( name="From_Date", description="From Date", baseType="DATETIME" )  DateTime from_date

Announcements


Top Tags