Control Binding Manager and .ToLocalTime()
Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1007
Printed Date: 27-Mar-2025 at 11:34pm
Topic: Control Binding Manager and .ToLocalTime()
Posted By: HFloyd
Subject: Control Binding Manager and .ToLocalTime()
Date Posted: 21-Nov-2008 at 10:25am
Hi,
I am storing "DateLastModified" for every record/bo in my system. On the data-entry form, I want to show this date.
Using the CBM, I can choose this property and it shows up on the form. However, I store a UTC date in the database, but would like to display it in local time on the form. I am unclear how to do this, since .ToLocalTime() is a method, not a property of a date.
Is there some way to use either the CBM or via code to make the binding to DateLastModified.ToLocalTime()?
Thanks!
Heather
|
Replies:
Posted By: davidklitzke
Date Posted: 21-Nov-2008 at 10:40am
Make your own custom property (like "FullName")
|
Posted By: HFloyd
Date Posted: 21-Nov-2008 at 10:55am
David,
I assume you mean add something like this to all my BOs:
/// <summary> /// Get the Localized Version of DateLastModified /// </summary> public DateTime? DateLastModifiedLocal { get { if (this.DateLastModified != null) return this.DateLastModified.Value.ToLocalTime(); else return null; } }
That will take a little time, but is certainly do-able.
Thanks!
Heather
|
Posted By: davidklitzke
Date Posted: 21-Nov-2008 at 11:10am
That was what I was thinking of.
|
|