You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Pierre Smits <pi...@gmail.com> on 2010/09/06 10:55:47 UTC

date/time in groovy

Hi all,

In a .groovy file I want to capture from a query-string a date-time string
for the start of a period ( &psd=2010-09-01 09:14:00.000) and a date-time
string for the end of a period (&ped=2010-09-06 10:46:13.000).

In the .groovy file I have following code:

periodStartDate = parameters.psd;
tmpPSD =
UtilDateTime.getDayStart(UtilDateTime.toTimestamp(periodStartDate));

periodEndDate = parameters.ped;
tmpPED = UtilDateTime.getDayEnd(UtilDateTime.toTimestamp(periodEndDate));

But when I look at the result of both tmpPSD and tmpPED I don't get the
expected DayStart value for tmpPSD or DayEnd value for tmpPED, but the
DayStart and DayEnd values for today....

How can I resolve this?

Regards,

Pierre

Re: date/time in groovy

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Hi Pierre,

Sounds like getDayStart() is being passed a null argument.  Either parameters.psd is returning null or toTimestamp() is.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 6/09/2010, at 8:55 PM, Pierre Smits wrote:

> Hi all,
> 
> In a .groovy file I want to capture from a query-string a date-time string
> for the start of a period ( &psd=2010-09-01 09:14:00.000) and a date-time
> string for the end of a period (&ped=2010-09-06 10:46:13.000).
> 
> In the .groovy file I have following code:
> 
> periodStartDate = parameters.psd;
> tmpPSD =
> UtilDateTime.getDayStart(UtilDateTime.toTimestamp(periodStartDate));
> 
> periodEndDate = parameters.ped;
> tmpPED = UtilDateTime.getDayEnd(UtilDateTime.toTimestamp(periodEndDate));
> 
> But when I look at the result of both tmpPSD and tmpPED I don't get the
> expected DayStart value for tmpPSD or DayEnd value for tmpPED, but the
> DayStart and DayEnd values for today....
> 
> How can I resolve this?
> 
> Regards,
> 
> Pierre