Content Obsolete

This content is no longer current. Our recommendation for up to date content:

Download this episode

Download Video

Download captions

Download Captions


Dates and times are represented using special types (just like strings are) and deserve some attention. In this lesson we learn how to work with Date and Time data, how to create new instances of Date, how to add time; format the data for display and more. Furthermore, we discuss the TimeSpan class as a means of representing a duration of time.

Download the source code for Working with Dates



Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image

      A point to note in this lesson; when converting a literal date, it must be in US format or it will either reject it or incorrectly convert it.
      e.g My birthdate is July 20th and I live in Australia. The way it is written in Australia is #20/07/1951# but this will be rejected by the compiler. If however you enter as #07/20/1951# it correctly displays on the screen using local format (20/07/1951).
      I notice that this is also the case when writing dates in an SQL string.

    • User profile image

      @Kieth: Thank you very much for making that point.  Clearly, I'm speaking purely from a USA perspective, and I apologize.  Bad habit when speaking to a global audience!  Again, sincere thanks for adding that note!

    • User profile image

      Bob-I've been working my way through these videos, and I just wanted to take a minute and thank you for putting this series together.  I wouldn't call myself an "absolute beginner" but instead would say that "I know enough about visual basic to be dangerous".  Thanks for the great review!  Also, I wouldn't worry too much about being around 16,000 days old - the number I calculated based on my birth date was about 22,000.  And I don't feel a day over 16,000!

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.