From the course: Visual Basic Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Work with dates and times

Work with dates and times - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

Work with dates and times

- [Instructor] I've previously described how to work with numbers and strings, and now I'll move to the third most popular data type, dates. In Visual Basic, a date value contains both the date and the time, and there are a variety of ways of creating date variables. We'll look at three ways to set date and time values, with a literal, with parse, and by getting the current system clock information. To declare a variable, you start, like any other variable, with the dim keyword. And then here, instead of using a string value to set the literal date, I will use the date delimiters, which is the pound symbol or the number sign. Now I can put in the value I want, and it will take this literal value and put it in this literal date. You can also use date.parse, like this. Now I can put a string value in here, like that. And then it'll attempt to parse that value, if it looks like a valid date. Another way to do this is to work…

Contents