# Julian Functions for Date Calculations

- Prashanth Krishnamurthy
- Siebel technology
- March 11, 2015

Requirements for calculating difference between two dates, getting a target date by adding number of days/hours, or working day calculations are quite common. Julian functions rescue us in most of those scenarios.

Julian dates are just numbers considering a fixed start date. They are used for easier date calculations since the dates are reduced to mere numbers and integer operations are simpler. Their use is decreasing in recent times because most of the software include capabilities to directly calculate on dates.

Siebel implements the Oracle’s definition of Julian date. The start date in this case is Jan 1, 4712 BC.

If I can enumerate them quickly, Julian functions include -

[table id=7 /]

Since the Julian functions return numerals, the easiest application to think of is the difference between any given dates.

For example: to calculate number of months between a start and an end date -

```
JulianMonth([End]) - JulianMonth([Start])
```

If Start = 1-Jan, and End = 9-Apr, # months = 3.

It does not matter whether you’re spanning years, or centuries (though become to understand that Siebel supports 20th and 21st centuries only!). Leap year and end-of-century leap year are included in the calculations.

The syntax is similar for any other Julian functions. They can as easily be used to find differences between months, years, quarters, weeks, or days.

Julian functions are used in calculated expressions - they may be in fields, workflows, or runtime events, but find the most usage in calculated fields.

Alternatively, you can make direct date calculations as well, or write scripts to perform date calculations .