function

datediff . date . sncode

VERSIONlatest Date difference

DATEDIFF

NAME

datediff - Difference between date

SYNOPSIS

datediff(ldate1, date2[, mode: mode])

DESCRIPTION

Return the difference between 2 dates. The difference is in day, hour, min sec, week or year.

By default its the difference in day

EXAMPLES

    %include "/sncode/extenso.sn"; datediff ("2016-01-05", "2016-01-06",mode:DATEDIFF_DAY) return 1
    %include "/sncode/extenso.sn"; datediff ("2016-01-05", "2016-01-06",mode:DATEDIFF_HOUR) return 24
    %include "/sncode/extenso.sn"; datediff ("2016-01-05", "2016-01-06",mode:DATEDIFF_MIN) return 1440
    %include "/sncode/extenso.sn"; datediff ("2016-01-05", "2016-01-06",mode:DATEDIFF_SEC) return 86400
    %include "/sncode/extenso.sn"; datediff ("2016-01-05", "2016-01-14",mode:DATEDIFF_WEEK) return 1
    %include "/sncode/extenso.sn"; datediff ("2016-01-05", "2019-01-14",mode:DATEDIFF_YEAR) return 3

 

The file /sncode/extenso.sn might not be installed on your system. The definitions are:

// Mode for datediff function

%define DATEDIFF_DAY                0;

%define DATEDIFF_HOUR               1;

%define DATEDIFF_MIN                2;

%define DATEDIFF_SEC                3;

%define DATEDIFF_WEEK               4;

%define DATEDIFF_YEAR               5;

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>