Re: [groovy-user] Need help with TimeDuration/TimeCategory
Dave Hicks <
dhdev@...>
2011-07-01 05:45:16 GMT
So, if I understand what you're saying, then TimeDuration is really just
a bean? It doesn't actually do anything useful. It just holds data?
On 07/01/2011 01:29 AM, nagaimasato.pub@... wrote:
> And TimeCategory's months/days/hours work only for integers and they
> just return integers as TimeDuration object.
> So the "duration.hours" means calling TimeDuration.getHours().
> TimeCategory does nothing in the case.
>
> On Jul 1, 2011 2:17pm, nagaimasato.pub@... wrote:
> > TimeDuration's months/days/hours are just properties. You need to
> format by yourself.
> >
> >
> >
> > On Jul 1, 2011 7:03am, David Hicks dhdev@...> wrote:
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > I'm attempting to "pretty print" an uptime value from a database
> > > server. The value I have is in minutes. I thought it should be a
> > > breeze to print it out like...
> > >
> > > Months: xxx, Days: xxx, Hours: xxx ... etc
> > >
> > >
> > > Apparently, I was wrong, or I'm just missing something. Here's what
> > > I've got right now:
> > >
> > > def duration = new TimeDuration(0,0,uptime,0,0)
> > >
> > > use(groovy.time.TimeCategory) {
> > >
> > > println "Uptime for Database: Months: ${duration.months},
> > > Days: ${duration.days}, Hours: ${duration.hours}, Minutes:
> > > ${duration.minutes}"
> > >
> > > }
> > >
> > >
> > > The output I get is:
> > >
> > > Uptime for Database: Months: 0, Days: 0, Hours: 0,
> > > Minutes: 9190499
> > >
> > >
> > > Surely, I'm doing something stupid. Any help?
> > >
> > > Thanks,
> > >
> > > Dave
> > >
> > >
> > >
> > >
> > >
> > >
> > >
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email