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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

DateTime --> datatype

(0) ShareShare
ReportReport
Posted on by

I am trying to import a txt file and the data is    2005-02-09 13:30:36.493000000 and iam using datatype as datetime and iam getting error ---> "The date is not valid".

what can i do in this case is this region issue or anything else!!

I have the same question (0)
  • Verified answer
    Roger Larsson Profile Picture
    25 on at

    Import as text, the evaluate into DateTime using XML-format (9).

  • Suggested answer
    pankaj.k Profile Picture
    1,020 on at

    Hi 

    you need to  Remove Red marked value because its take only 3diget  for millisecond 2005-02-09 13:30:36.493000000   

    Please check URL :  https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/datetime/datetime-data-type

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    You can try below code

     var
            DTTextValue: Text;
            newTime: Time;
            newDateYear: Integer;
            newDatemonth: Integer;
            newDateDay: Integer;
            NewDate: Date;
        begin
            DTTextValue := '2005-02-09 13:30:36.493000000';
            EVALUATE(newTime, COPYSTR(DTTextValue, 12, 11));
            EVALUATE(newDateYear, COPYSTR(DTTextValue, 1, 4));
            EVALUATE(newDatemonth, COPYSTR(DTTextValue, 6, 2));
            EVALUATE(newDateDay, COPYSTR(DTTextValue, 9, 2));
            NewDate := DMY2DATE(newDateDay, newDatemonth, newDateYear);
            MESSAGE('%1..%2', NewDate, newTime);
        end;

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,072 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,129 Super User 2026 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 650 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans