SmartDate and DateTimeOffset
SmartDate and DateTimeOffsetOld forum URL: forums.lhotka.net/forums/t/8350.aspx
GregDobbs posted on Wednesday, January 13, 2010Hello all.
I've been unable to get SmartDate to persist DateTimeOffset values to the database.
Public Shared RegistrationDateProperty As PropertyInfo(Of SmartDate) = RegisterProperty(New PropertyInfo(Of SmartDate)("RegistrationDate"))
Public Property RegistrationDate() As String
Return GetPropertyConvert(Of SmartDate, String)(RegistrationDateProperty)
Set(ByVal value As String)
SetPropertyConvert(Of SmartDate, String)(RegistrationDateProperty, value)
The above result in a standard datetime value being inserted into SQL Server - the offset value is ignored.
Anyone else handled this issue?
RockfordLhotka replied on Wednesday, January 13, 2010
SmartDate internally uses a DateTime to store its information. It is a wrapper around DateTime, so the behavior you observe is correct.
SmartDate is convertible to/from other date types such as DateTimeOffset, but internally it doesn't maintain its information in that type.
GregDobbs replied on Thursday, January 14, 2010Thanks for the response, Rocky.
I guess my choices are 1) to modify the internal structure of SmartDate so it stores DateTimeOffset by default or 2) perhaps create my own version such as SmartDateOffset.
RockfordLhotka replied on Thursday, January 14, 2010Yes, I think that is a fair summary.
Kyle replied on Wednesday, October 13, 2010
It's been a while since anyone posted to this thread. I see that Rocky has put in SmartDateOffset as a future feature. Has anyone already coded (and tested) something that they could share in the meantime?
Copyright (c) Marimer LLC