Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

TalendDate.setDate: impossible to set minutes ?

Hi everybody,
I try to use the TalendDate.setDate function. It works fine with the following statement:
tmpDate = TalendDate.setDate(context.CurEndDate, 0, "HH");
It sets the hour to 00
but when I want to set the minutes to 00:
tmpDate = TalendDate.setDate(context.CurEndDate, 0, "mm");
it says :
java.lang.RuntimeException: Can't support the dateType: mm
Why can't we set minutes using this function ?
And how can I work this around to set my date to midnight (for instance: 2012-04-03 12:00 becomes 2012-04-03 00:00)
thanks in advance!
Labels (3)
1 Reply
Anonymous
Not applicable
Author

well, an idea (not the best one for sure):
Date tmpDate;
String stmpDate;
tmpDate=context.CurEndDate;
// convert to string with yyyy-MM-dd format
stmpDate = TalendDate.formatDate("yyyy-MM-dd", tmpDate);
// concat with time to midnight
stmpDate = stmpDate + " 00:00";
// parse to Date with format yyyy-MM-dd HH:mm
tmpDate=TalendDate.parseDate("yyyy-MM-dd HH:mm", stmpDate);
it returns the date set to midnight