web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Date Value(01\01\1900) Ax 2012

(0) ShareShare
ReportReport
Posted on by 288

Hi, Everyone

I have a requirement to set Date value as default in a table date field as 1\1\1900 but I have to try to create this value in the table this won't pick it up. Please see the below code and give any suggestion.

 CustomTable      custom;   // Table buffer creation
 date d;                 
 //Transdate   _date;
 ;

 ttsbeign;
 // _date = 01\01\1900;
    
 d = mkDate(1,1,1900);
 custom.DateValue  =  d;      // set date value to table date field
    
 //custom.DateValue = _date;
    
 custom.insert();               // insert operation perform
     
 ttscommit;

Thanks in Advance.


*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at
    RE: Date Value(01\01\1900) Ax 2012

    Hi Lakshmanan Selvaraj,

    1/1/1900 is a default value for date fields, so if you create a new record AX would use it by default, you don't need to do anything here.

    If you want to update existing value you can use dateNull() method like:

    custom.DateValue = dateNull();
    
    custom.update();


  • Peter John Profile Picture
    288 on at
    RE: Date Value(01\01\1900) Ax 2012

    Hi, ievgen.

    I have tried your words but again I cannot get the value see the below screenshots for your reference. Please give an suggestions

    QuestionAsk.png

  • Mea_ Profile Picture
    60,284 on at
    RE: Date Value(01\01\1900) Ax 2012

    Go to database using SQL management studio and check what is there or use debugger. Because function that you use does not show this date, empty value in AX is 1/1/1900, so instead of 1/1/1900 you will see empty value everywhere in UI, but in SQL DB it would be 1/1/1900.

    You can do next:

    info(date2StrXpp(custom.DateValue));

  • Peter John Profile Picture
    288 on at
    RE: Date Value(01\01\1900) Ax 2012

    I am using your code but Only got the Infolog and still, they are the same. Please find the below screenshot for your reference and suggest what can I do from here and I d'not know what I have to do 

    QuestionAsk1.png

  • Mea_ Profile Picture
    60,284 on at
    RE: Date Value(01\01\1900) Ax 2012

    As I said before AX shows 1/1/1900 as an empty value, in SQL database it is stored as 1/1/1900 but in AX it shows as Empty! Go to SQL and check. You won't be able to see it in table browser.

  • Peter John Profile Picture
    288 on at
    RE: Date Value(01\01\1900) Ax 2012

    Ok I will try and let you know

  • Peter John Profile Picture
    288 on at
    RE: Date Value(01\01\1900) Ax 2012

    You were right got the value in SQL Please find the below screenshot,

    but I have to appear on the table browser for the requirement to depends upon the value to do some logic's Please suggest what I have to do appear on the table browser ?? Please suggest

    6562.Sql.png

  • Verified answer
    Mea_ Profile Picture
    60,284 on at
    RE: Date Value(01\01\1900) Ax 2012

    Table browser is for developers only and users should not have access to it. And you as a developer should understand that empty date is 1/1/1900 without any changes.

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at
    RE: Date Value(01\01\1900) Ax 2012

    Hi!

    Why you can't use dateNull() ? You can use it in your logic. 

    The dateNull() method always return the value

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

    AX doesn't allow to assign null to date fields, it simply uses 01\01\1900 as a default value.

  • Peter John Profile Picture
    288 on at
    RE: Date Value(01\01\1900) Ax 2012

    Ya thank you Ievgen when I will get empty value it should assume as 1/1/1900 this value.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#3
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans