One Star

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!
One Star

Re: TalendDate.setDate: impossible to set minutes ?

well, an idea (not the best one for sure):
Date tmpDate;
String stmpDate;
// 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