velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <mkien...@alaska.net>
Subject [Vel-Tools] Converting a long return type into a formatted Date
Date Thu, 06 Jan 2005 19:50:34 GMT
I'm trying to figure out how to convert File.lastModified (type long) into a 
formatted date in Velocity.

It appears that I need to use DateTool.toDate(Long obj) to go from a long 
value to a Date.

However, neither NumberTool nor MathTool provides a method to convert a long 
to a Long.   I can convert it to an Integer with MathTool.toInteger().  Or 
MathTool.toNumber() and -- if the number is large enough -- it'll force it 
to be a Long, but it's not guaranteed.

Perhaps DateTool should be modified to handle toDate(Number obj).   Or 
MathTool modified to provide toLong(), toFloat(), etc.   Or both.

Hopefully, I'm overlooking something obvious, which is why I posted to user 
and not dev.

Thanks,

-Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message