-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Formatting dates
PostPosted: Tue Jun 14, 2005 3:09 pm 
Beginner
Beginner

Joined: Tue May 17, 2005 2:48 pm
Posts: 47
I have an object with a date property which is defined like this in the mapping file:
Code:
<property name="Date" column="date" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate"/>


Now the output of this property looks like "13-8-2004 0:00:00". Can I format the date property to "13-8-2004"?
I can do this in ASP.NET by writing a function which does this, but I was wondering if NHibernate could do it for me.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 14, 2005 4:31 pm 
Regular
Regular

Joined: Mon May 16, 2005 2:15 pm
Posts: 59
I think formatting the date would be a UI layer thing, not something that NHHibernate or even your business layer would do.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 14, 2005 8:50 pm 
Expert
Expert

Joined: Fri May 13, 2005 5:56 pm
Posts: 308
Location: Santa Barbara, California, USA
agree with pilot bob, UI layer. here is a sample from mine:

Code:
Literal dateCreated = (Literal) FindControl("_dateCreated");
dateCreated.Text = this._emailTemplate.DateCreated.ToString("F");


creates a date that looks like:

Quote:
Tuesday, June 14, 2005 5:49:39 PM


check the ToString method of the DateTime class for formatting options.

cheers,

-devon


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.