When designing a report, users often need a lot of date time functions. However, most reporting tools only provide some common functions
as follows: functions today(), now() which are used to get current date or time, and functions year(), month(), day(), hour(), minute() or second() which are used to get corresponding year, month, day, hour, minute or second from a date time. In addition, there are some data type conversion functions, which are used to convert date time to string or convert string to date time.
However, that’s far from enough, as users may often have complex requirements like the ones below:
1. Calculate age accurately. Many reporting tools have no specialized function to do this.
Some provide, but as the accuracy is only year or month, the result may be not exactly right. Take a child born in May 23, 2000 for example. He is only 7 years old, not 8 in May 20, 2008. It is easy to find that users can get the exactly right age only through a function with day accuracy.
2. Calculate the beginning or the end of a time period.
With functions like weekbegin(), weekend(), monthbegin(), monthend(), yearbegin and yearend(), users can calculate the beginning or the ending of a week, a month or a year. Besides, calculating the beginning or the ending of a quarter is also very common. However, almost no reporting tool provides corresponding quarter functions.
3. Calculate the difference between two dates or two time points.
For dates, users sometimes need to calculate the number of days between two dates, the date which is N days away from a specific date, or just last day, last month, last year and so on. The case for time point is similar. Requirements for these functions are common. However, most reporting tools neglect them. As a result, users have to write functions by themselves.
is the best choice to solve these problems. It provides much more date time functions specifically to meet users’ needs and wants.
This post is from freezea's blog. You are welcomed cc it anywhere, and please indicate the source.
If you would like to read more articles about reporting tool, you are also welcome to refer to my blog