Back in the halcyon days of RPG II/III, calculating differences between two dates or times was enormously complex and took tons of code (does anyone else remember Paul Conte’s multi-part "Ultimate Date Routines" series in NEWS/400 magazine?). Well, that was then and this is now.

.NET offers superb date calculation capabilities. Let’s take a brief look at how to use them. Let’s say you wanted to know how long it’s been since the Beatles’ US debut on Ed Sullivan’s stage on February 9th, 1964 and the last time they played together live on that blustery rooftop in London (with the late, great Billy Preston on the organ) on January 30th, 1969.

Here is the nearly self-explanatory code to calculate date durations in ASNA Visual RPG:


Figure 1. Program output

Crazy, huh? The magic is in the System.TimeSpan structure , which represents a time interval. As you can see, TimeSpan is capable of rendering differences in several units.

The example above shows just the tip of the iceberg for what you can do with dates and times in AVR for .NET. Study the TimeSpan structure for more of its capabilities.