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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

JProperty is converting JSON Datetime to US format

(1) ShareShare
ReportReport
Posted on by 17
Hi, 
 
I am working on JSON file and the file comes with Datetime 
when the JProperty converts the date to US date format
 
but it works correctly with date and converts the date when it is DateTime.
 
Any solution for this?
Thanks
 
I have the same question (0)
  • Khushbu Rajvi. Profile Picture
    20,275 Super User 2025 Season 2 on at
    What is the issue? I’m having difficulty understanding your question.
  • MR-13061333-0 Profile Picture
    17 on at
    Hi Khushbu,
     
    I am importing a Json file to Business Central table I can see the datetime is in ISO format in first screenshot but when I call JSONMgt.GetValueAndSetToRecFieldNo( function the Value in below function changes the date in datetime value into mm/dd/yyyy format. The datbase is UK based so it does fail.
     
    Thanks
     
      procedure GetPropertyValueFromJObjectByPathSetToFieldRef(JObject: DotNet JObject; propertyPath: Text; var FieldRef: FieldRef): Boolean
        var
            OutlookSynchTypeConv: Codeunit "Outlook Synch. Type Conv";
            JProperty: DotNet JProperty;
            RecID: RecordID;
            Value: Variant;
            DecimalVal: Decimal;
            BoolVal: Boolean;
            GuidVal: Guid;
            DateVal: Date;
            Success: Boolean;
            IntVar: Integer;
        begin
            Success := false;
            JProperty := JObject.SelectToken(propertyPath);
     
            if IsNull(JProperty) then
                exit(false);
     
            Value := Format(JProperty.Value, 0, 9);
  • Suggested answer
    Vahid Ghafarpour Profile Picture
    12,090 Super User 2025 Season 2 on at
    Did you try to use JsonValue.AsDateTime()?
     
    May it help you
     
     

    ** Please don't forget to close up the thread here by Like and verify it as an answer if it is helpful **

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans