Formatting Dates & TimeSuppose you have a date that you would like to format. You can use the FormatDateTime function to do this for you. Note that this is the time at the server, not necessarily the viewer's local time. Let's assume that we're working with today's date. This makes it real simple. For example, today is 02/15/2000.
Now, let's assume that we need the date and time: 02/15/2000 4:15:14 AM
Let's say, however, that we want to display the date like this: Tuesday, February 15, 2000.
You can format time the same way. For example, it is now 4:15:14 AM.
If you want only the time, you can use the word Time.
Now let's assume we want to format the time a bit differently, without the seconds. For example,
Now let's see what happens when we use these numbers with Time:
You can also break out hour, minutes and seconds if you need to.
For information on working with parts of dates (month, day, year), please see the Month Day Year page. Related information on working with dates is located on the Date Calculations page. |