IsDate


Definition: Returns a Boolean value indicating whether an expression can be converted to a date.

 

Windows PowerShell makes it easy to format and manipulate date and time values … provided, of course, that you actually havedate and time values. To verify that a value truly isa date-time value all you have to do is use the –isoperator and check to see if the data type is datetime. For example, these two lines of code assign a value to the variable $ a andthen determine whether or not $a is a date-time value:

 

$a = 11/2/2006
$a -is [ datetime]

 

When you run this command you should get the following:

 

False

 

Why is this False; why isn’t 11/2/2006 a valid date? That’s easy: to assign a date to a variable you need to enclose that date in double quote marks and specify the [ datetime] variable type:

 

$a = [ datetime] "11/2/2006"

 

Without the double quote marks Windows PowerShell believes that this is a mathematical expression: 11 divided by 2 divided by 2006. In fact, if you check the value of $ a you’ll get back this:

 

0.00274177467597208

 

With the quotes but without the [ datetime] specified,Windows PowerShell thinks this is a string and still returns False.

 

 

 

500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@systemmanager.forsenergy.ru to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.