![]() |
|
|
In the previous FAQ, I discussed how one could use DateSerial to form a date. In this FAQ I will discuss a few other, powerful date functions. DatePart is a useful date function, because it allows you to display a "part" of a date. For example, we can print out the month for a date by using code like this: This will return 11. The DatePart function takes up to four properties:
Interval can be any one of the following values (in quotes)
The optional Yet another powerful date function is DateAdd, which adds a certain interval to a date. The intervals are the same as above for the DatePart. Here is the specification for DateAdd:
Using DateAdd you could construct a date two months in the future. Let's say that we wanted to print out the day of the week exactly a year ago from today. No problem, all we need to use is DateAdd and DatePart. Notice that you can use DateAdd to sort of subtract from a date by using a negative number. Date functions are definately powerful, useful, and easy to use in ASP.
Related Articles:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||