JAMS Developer Guide
ValidateKind Method


MVPSI.JAMS Namespace > DateTimeExtensions Class : ValidateKind Method
A DateTime which should have its Kind changed
The new Kind which oldValue should be assigned
Acts like SpecifyKind, but throws an exception* if the conversion would lead to timezone offset errors. *TODO: For now, this doesn't throw an exception, it just logs a stack trace. Can be changed to an exception later.
Syntax
'Declaration
 
<System.Runtime.CompilerServices.ExtensionAttribute()>
Public Shared Function ValidateKind( _
   ByVal oldValue As System.Date, _
   ByVal newKind As System.DateTimeKind _
) As System.Date
'Usage
 
Dim oldValue As System.Date
Dim newKind As System.DateTimeKind
Dim value As System.Date
 
value = DateTimeExtensions.ValidateKind(oldValue, newKind)
[System.Runtime.CompilerServices.Extension()]
public static System.DateTime ValidateKind( 
   System.DateTime oldValue,
   System.DateTimeKind newKind
)

Parameters

oldValue
A DateTime which should have its Kind changed
newKind
The new Kind which oldValue should be assigned

Return Value

The new DateTime with its Kind set to newKind
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DateTimeExtensions Class
DateTimeExtensions Members