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

Business central - date formatting in CSV

(9) ShareShare
ReportReport
Posted on by 42
Hi Team, 
I need to export few fields in payment journals into csv file. document date is getting exported as  11/6/2025 but we need 11/06/2025. 
Can you please suggest the ways i can export date as expected.
 
 
 
Thanks!
 
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,977 Super User 2025 Season 2 on at
    Moved the question from the Dynamics 365 General to the Dynamics 365 Business Central forum.
    I also updated the title to let volunteers know the contents of the question. Just "Business Central" is too generic.
  • Suggested answer
    Jainam M. Kothari Profile Picture
    15,639 Super User 2025 Season 2 on at
    Hello,
     
    To export the Document Date from Payment Journals in the DD/MM/YYYY format (e.g., 11/06/2025) in Business Central, you can format the date using AL code in a custom report or XMLport with FORMAT("Document Date", 0, '<Day,2>/<Month,2>/<Year,4>').
     
    If you're exporting to Excel, apply a custom date format (dd/mm/yyyy) in Excel itself. For data exchange or page extensions, ensure the date is formatted before writing to the CSV.
  • Suggested answer
    Sumit Singh Profile Picture
    10,079 on at
     
    CSV is plain text, so as far as I know you might output the date as text already formatted as dd/mm/yyyy before saving in CSV.

    Workaround: Convert Date to Text Before Saving CSV (No Customisation-And as per my knowledge and trial)
    Here’s a step-by-step workaround that ensures the date is exported as dd/mm/yyyy with leading zeros:
    Step 1: Use a formula to convert date to text
    In a new column (e.g., Formatted Date), enter:
    =TEXT(A2, "dd/mm/yyyy")
    • Replace A2 with the cell containing your original date.
    • This will show 11/06/2025 instead of 11/6/2025.
    Step 2: Copy and Paste as Values
    1. Select the entire Formatted Date column.
    2. Right-click → Copy.
    3. Right-click again → Paste Special → Values.
      • This replaces formulas with actual text values.
    Step 3: Delete the original date column (optional)
    This ensures only the correctly formatted date is exported.
    Step 4: Save as CSV
    Go to File → Save As → CSV (UTF-8).
    Now the date will appear as 11/06/2025 in the CSV file, not 11/6/2025.
     
  • Suggested answer
    Valentin Castravet Profile Picture
    31,342 Super User 2025 Season 2 on at
    Can you provide more information, how are you exporting to a CSV file? Did you create a custom export or are you using data exchange definitions?
     
  • Suggested answer
    PC-03070839-0 Profile Picture
    42 on at
    Hi, 
    I have used custom procedure.
      ExportTextBuilder.AppendLine(
                            StrSubstNo(
                                Text001Lbl,
                                BankAccountNo,
                                TransitNumber,
                                VendorRec.Name,
                                Format(CurrCheckNo),
                                Format(TotalAmount, 0, 9),
                                //   Formateddate,
                                // Format(TempJournal1."Document Date", 0, '<Month,2>/<Day,2>/<Year4>'),
                                FormatDateMMDDYYYY(TempJournal1."Document Date"),
                                VendorRec.Address,
                                VendorRec."Address 2",
                                VendorRec.City,
                                VendorRec.County,
                                CountryCode,
                                VendorRec."Post Code"
                            )
  • Suggested answer
    OussamaSabbouh Profile Picture
    5,798 on at
    Hello,
     
    When exporting dates to CSV in Business Central, the system uses the environment’s regional format by default (e.g., 11/6/2025). To control the output format (e.g., 11/06/2025), you must use the AL FORMAT method with a custom date format in your export code.
     
    ✅ Example:
     
    TextDate := FORMAT("Document Date", 0, '<Day,2>/<Month,2>/<Year4>');
     
    This outputs 11/06/2025 consistently regardless of regional settings.
     
    Regards,
    Oussama Sabbouh
  • Suggested answer
    Gregory Mavrogeorgis Profile Picture
    763 on at
    Hi,
     
    Fastest (one-off)
    • Export as usual → open in Excel → format the Document Date column to dd/mm/yyyy → Save As → CSV.
      Excel will write 11/06/2025 into the CSV.
    No-code tweak in BC
    • My Settings → Region = English (United Kingdom) (or any dd/MM/yyyy locale), then re-export. Many exports pick up your region’s date format.
    Proper/automated
    • Data Exchange (CSV): in your Data Exchange Definition, set Data Formatting Culture = en-GB.
    • Custom AL export (XmlPort/Report): output the date as text:
    • DocDateTxt := Format("Document Date", 0, '<Day,2>/<Month,2>/<Year4>');
    and write DocDateTxt to the CSV.
     
    If you found this helpful please mark it as verified
  • Suggested answer
    Jeffrey Bulanadi Profile Picture
    8,760 on at

    Hi,

    BC’s default date formatting during CSV export often follows the system’s regional settings, which can lead to inconsistent formats like 11/6/2025 instead of the expected 11/06/2025. To control this, you’ll need to explicitly format the date field during export.

    Here are your options:

    • Use XMLport with custom formatting
    • If you're exporting via XMLport, you can apply a custom format using the FORMAT function:
      FORMAT("Document Date", 0, '<Day,2>/<Month,2>/<Year,4>')
    This ensures the day and month are always two digits, and the year is four digits.
     
    • Use AL code with TextBuilder or FileWriter

      If you're exporting manually using AL code, format the date before writing to the file:
      MyFormattedDate := FORMAT("Document Date", 0, '<Day,2>/<Month,2>/<Year,4>');
      FileWriter.Write(MyFormattedDate);
      ​​​​
    • Avoid relying on system locale
    • The default FORMAT(Date) uses the current user’s regional settings, which may vary. Always use explicit formatting to ensure consistency across environments. 
    • Test with different regional settings
    • If you’re using Data Exchange Definitions or Electronic Reporting, check the format settings in the mapping or transformation rules. These may also default to system locale unless overridden.
       

    Helpful Reference
    Export data to CSV using XMLport – Dynamics 365 Lab
    Community thread: Date formatting in CSV export


    If you find this helpful, feel free to mark this as the suggested or verified answer.

    Cheers
    Jeffrey

  • Suggested answer
    Aman Kakkar Profile Picture
    2,319 on at
    Hi,
     
    Hope this helps - 
     
    Format(TempJournal1."Document Date", 0, '<Month,2>/<Day,2>/<Year4>')
  • Suggested answer
    YUN ZHU Profile Picture
    95,449 Super User 2025 Season 2 on at
    Hi, hope the following helps.
     
    PS: Business Central 2024 wave 2 (BC25): New Date/Time/DateTime methods
     
    Thanks.
    ZHU

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,064

#2
Jainam M. Kothari Profile Picture

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

#3
YUN ZHU Profile Picture

YUN ZHU 1,063 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans