C# Convert ToDecimal(DateTime)
Description
Convert ToDecimal(DateTime)
calling this method always
throws InvalidCastException.
Syntax
Convert.ToDecimal(DateTime)
has the following syntax.
public static decimal ToDecimal(
DateTime value
)
Parameters
Convert.ToDecimal(DateTime)
has the following parameters.
value
- The date and time value to convert.
Returns
Convert.ToDecimal(DateTime)
method returns This conversion is not supported. No value is returned.
Example
/* w ww. j a va 2 s. com*/
using System;
public class MainClass{
public static void Main(String[] argv){
System.Console.WriteLine(Convert.ToDecimal(DateTime.Now));
}
}
The code above generates the following result.