Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Salesforce.com Date Format in Script Date Variable

I'm connecting to SFDC via the Qlikview API.  The format of the "Created Date" field in the EVENT object looks like this:

 

2015-01-01T00:00:00.000Z

I'm trying to create a variable to use instead which pulls for the last 6 months.  I've tried the formula below, but it's not working...

 

Let  vDate = TimeStamp((Floor(AddMonths(Today(),-5)) - Floor(Day(Today()))+1),'YYYY-MM-DD 00:00:00');

When I run the script it just appears "frozen", instead of running the query.  Any thoughts?

Thanks,  Dan

2 Replies
Anonymous
Not applicable
Author

Your varaible vDate has value 2014-11-01 00:00:00.  I assume this is what you want.  And, I assume, you want to load the data after vDate.  That is, you need to convert format 2015-01-01T00:00:00.000Z to YYYY-MM-DD hh:mm:ss.  Can be done like this, for example:

timestamp(timestamp#(purgechar(CreateDate,'TZ'), 'YYYY-MM-DDhh:mm:ss.fff'), 'YYYY-MM-DD hh:mm:ss') as CreateDate.

After this you can use vDate to compare the new XCreate Date with it.

Not applicable
Author

Thanks Michael for this conversion.It helped me:)