Date Max/Min Values

Hello,
i wonder if there is any similar to the .NET Values "System.DateTime.MaxValue/.MinValue in X++?

Thanks in advance,
Frank

Use GETRANGEMIN and GETRANGEMAX functions…

This question is AX - don’t think GETRANGEMIN or GETRANGEMAX works in X++ - that’s NAV code :slight_smile:

Topic moved from NAV Developer to AX Developer forum.

Topic moved from NAV Developer to AX Developer forum.
Sorry for that…

I just found out that there is a maxdate()-function (result ist 31.12.2154) but - surprise - no mindate()-function (minimum value is 01.01.1901…)
I think a “#define” is the right way…

Greets,
Frank

dateMax() / dateNull()

Thanks - dateMax() returns “31.12.2154”, but dateNull() returns … 0. And this is not a date…

Nope.

See class Global:

static date dateNull()
{
return 01\01\1900;
}

Where are you seeing this as zero? What is the problem you’re trying to fix?

Hi mrsalonen,
i just was wondering, if there is a function, that gives me the max/min date in x++. I need this for a time span (which should be nearly “endless”) and in .net i would use "System.DateTime.MaxValue/.MinValue. And i like to use system-functions instead of creating my own constants (or macros…).
This piece of code return 0:

date d = Global::dateNull();
;
debug::printDebug(d);

But i think i now know why: Minium possible date in AX is 01.01.1901. Every date below is displayed as zero (this is why the function is named dateNull…).

So i have to declare my own macros :slight_smile:

Thanks for help,
Frank

date dateMaximum = maxDate();

date dateMinimum = dateNull();

They’re working, really.

Thanks