[Building Sakai] ContentEntity Date Format

Jim Eng jimeng at umich.edu
Mon Feb 8 05:07:27 PST 2010


Or within Sakai 2.x code, you can retrieve the property's value using  
ResourceProperties.getTimeProperty()

http://source.sakaiproject.org/release/2.5.3/apidocs/org/sakaiproject/entity/api/ResourceProperties.html#getTimeProperty(java.lang.String)

That retrieves an object of type org.sakaiproject.time.api.Time, and  
you can use its getTime() method to get the long value, which is  
equivalent to the long value of a java.util.Date object representing  
the same millisecond.  If you need some particular value associated  
with that time (like year, month, day, etc), you can access that  
directly from the Time object or using an object of type  
org.sakaiproject.time.api.TimeBreakdown.

Jim


On Feb 8, 2010, at 4:46 AM, Steve Swinsburg wrote:

> Do you mean one of the properties you can retrieve from the Entity,  
> ie PROP_CREATION_DATE for example?
>
> If so, it's a String so you can use SimpleDateFormat to convert  
> String to Date.
>
> eg
> String dateStr = "08/02/2010";
> DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
> Date date = df.parse(dateStr);
>
> remembering Exceptions and Locales.
>
> cheers,
> Steve
>
>
>
> On 08/02/2010, at 6:09 PM, Matt Hoyt wrote:
>
>> Does anyone know how to convert the date in ContentEntity property  
>> to a
>> Java date?
>>
>> -- 
>> Matt Hoyt
>>
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org 
>>  with a subject of "unsubscribe"
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org 
>  with a subject of "unsubscribe"



More information about the sakai-dev mailing list