Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
DateTime.GetTypeCode() Method in C#
he DateTime.GetTypeCode() method in C# is used to return the TypeCode for value type DateTime. The returned value is the enumerated constant, DateTime.
Syntax
Following is the syntax −
public TypeCode GetTypeCode ();
Example
Let us now see an example to implement the DateTime.GetTypeCode() method −
using System;
public class Demo {
public static void Main() {
DateTime d = DateTime.Now;
TypeCode res = d.GetTypeCode();
Console.WriteLine("TypeCode of Date {0} = {1} ", d, res);
}
}
Output
This will produce the following output −
TypeCode of Date 10/16/2019 7:08:50 AM = DateTime
Example
Let us now see another example to implement the DateTime.GetTypeCode() method −
using System;
public class Demo {
public static void Main() {
DateTime d = new DateTime(2019, 10, 11, 7, 10, 40);
TypeCode res = d.GetTypeCode();
Console.WriteLine("TypeCode of Date {0} = {1} ", d, res);
}
}
Output
This will produce the following output −
TypeCode of Date 10/11/2019 7:10:40 AM = DateTime
Advertisements