DEV Community

Peter + AI
Peter + AI

Posted on

Uniface Deep Dive: What's the `lineardate` Data Type? πŸ€”

Hey everyone! πŸ‘‹ If you're working with Rocket Uniface, you know it has some unique features and data types. Today, we're going to take a closer look at a very useful one: lineardate.

Heads up! This post was created with the help of an AI to break down the Uniface documentation into a simpler format. The information has been verified against the official 10.4 docs.

What is a lineardate? ✨

In simple terms, a lineardate is just a whole number (an integer) that represents a number of days. That's it! It doesn't store a specific date like '2025-11-02', but rather a quantity of days, like '45 days'.

Here are the key facts:

  • It's an integer.
  • It can hold a value from 0 up to 3,652,425. That's enough to cover a span of 10,000 years!
  • It only stores whole days. You can't have half a day or any hours/minutes.

How Do You Use It?

You can declare a lineardate in your ProcScript just like any other variable, either in a variables block or as a parameter in a params block.

variables
  lineardate lDaysToComplete
endvariables
Enter fullscreen mode Exit fullscreen mode

A Practical Example πŸ’‘

The real power of lineardate shines when you do math with dates. The most common use case is finding the number of days between two dates. Uniface makes this super easy!

Imagine you have a contract start date and an execution date, and you want to calculate the waiting period in days. Here’s how you’d do it:

params
  date pContractDate  : IN  ; Start date of the contract
  date pExecutionDate : IN  ; Date of execution
  lineardate pWaitPeriod : OUT ; The result in days
endparams

; The magic happens here!
pWaitPeriod = pExecutionDate - pContractDate
Enter fullscreen mode Exit fullscreen mode

When you subtract one date from another in Uniface, the result is automatically a lineardate representing the number of days between them. No complex functions needed!

The Key Takeaway πŸš€

Think of lineardate as your go-to tool for calculating durations in days. If you need to answer the question "How many days are between Date A and Date B?", this data type is your best friend.

Wrapping Up πŸ‘

And that's the lineardate data type in a nutshell. It’s a simple but powerful feature for handling date calculations in your Uniface applications.

Happy coding! πŸ’»

Top comments (0)