New Posts New Posts RSS Feed: Control Binding Manager and .ToLocalTime()
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Control Binding Manager and .ToLocalTime()

 Post Reply Post Reply
Author
HFloyd View Drop Down
Groupie
Groupie


Joined: 27-Jul-2007
Location: United States
Posts: 44
Post Options Post Options   Quote HFloyd Quote  Post ReplyReply Direct Link To This Post Topic: Control Binding Manager and .ToLocalTime()
    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
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 21-Nov-2008 at 10:40am
Make your own custom property (like "FullName")
Back to Top
HFloyd View Drop Down
Groupie
Groupie


Joined: 27-Jul-2007
Location: United States
Posts: 44
Post Options Post Options   Quote HFloyd Quote  Post ReplyReply Direct Link To This Post 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


Edited by HFloyd - 21-Nov-2008 at 1:35pm
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 21-Nov-2008 at 11:10am
That was what I was thinking of.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down