Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step tutorials and online videos.

Click Here To Learn More »

9.12 DateSerial(), TimeSerial()

DateSerial( ) and TimeSerial( )

The DateSerial() and TimeSerial() functions can be used to create a date or time by passing the parts of the value as separate parameters to the function. The DateSerial() parameters are the year, month and day. The DateTime() parameters are the hour, minute, and seconds.

In the simplest form, these functions create a date or time using three parameters. But these functions are also very powerful for adding and subtracting values to a Date and Time. They are different from the DateAdd() function in that they perform the calculations using a cumulative process. They start by calculating a partial date (or time) value and then build upon it and modify it each step of the way. It starts by calculating the year, then it calculates the month and finally the day. This is easiest to see by looking at a simple example first and then a more complex example. All of the examples use the following statements to declare and initialize the variable MyDate.

This code snippet shows the variable declaration that is used for the remaining examples.

‘Declare the variable for use in the examples
...

Get UNLIMITED Crystal Reports Online Training!

Click Here To Start Your Training!

1500+ Tutorial Pages

Complete Crystal Reports Online Training with over 1,500 pages of better than book quality Crystal Reports tutorials.

Step-by-step Online Videos

Learn at your own pace from the comfort of your home! Pause, rewind and watch online training videos anytime!

Online Community

Members-only community where you can post and answer questions. The community is checked on a regular basis by best selling Crystal Reports book author Brian Bischof to help answer your questions.

Cut & Paste Source Code

Save time with simple cut and paste source code you can use right now in your next report!

Click Here To Start Your Training!