I am currently looking at the msdn pages for the date and datetime object. I also have reflector opened up, and it looks like the date and datetime object just reference the Date structure. Why do we have two objects which reference the same structure? what is the differences between them?
Python datetime Classesdatetime – Allows us to manipulate times and dates together (month, day, year, hour, second, microsecond). date – Allows us to manipulate dates independent of time (month, day, year).
date Objects. A date object represents a date (year, month and day) in an idealized calendar, the current Gregorian calendar indefinitely extended in both directions. January 1 of year 1 is called day number 1, January 2 of year 1 is called day number 2, and so on. 2 class datetime. date (year, month, day)
The datetime object is kind of a combination of date and time objects. It can store information from year to microseconds. The datetime module also provides some other object types such as timezone, strftime, and strptime.
Using the datetime() Pass the year, month and day values of the desired date object (as my_date. year, my_date. month, my_date. day) to this constructor to convert a date object to datetime object.
The CLR classes (e.g. DateTime
, Int32
, etc.) contain the actual implementation. This is what you will see in Reflector.
Due to their heritage, C# and VB define certain aliases for commonly used data types. For example, int
in C# is an alias of Int32
. In VB, one such alias is Date
for DateTime
.
Here are lists of these aliases:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With