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...
Suggested Answer

Converting DateTime to UNIX Timestamp in AL/Business Central - Strange behavior with Decimal to String conversion

(0) ShareShare
ReportReport
Posted on by 20

Greetings Community -

I found an online blog (don't remember the URL) which helped me get the function below to convert DateTime format to UNIX Format.

The output of the below function is accurate, however, when I get the Decimal as a return value of the function and try to convert it to text, the additional spaces show up between the digits, strangely enough

After trying DELSTR(String,'='), the spaces don't go away. I am probably missing something, can anyone please assist?

pastedimage1674571989099v1.png

pastedimage1674572018260v2.png

ajkauffmann 

I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    11,417 Super User 2026 Season 1 on at

    hi

    try this

    DELCHR(ResourceUpdAPIPArams,'=',' ')

    DAniele

  • rtechc Profile Picture
    20 on at

    Hi Daniel - Thanks for the suggestion. I tried both these formats of DELCHR, but it does not seem to work, same output. Moreover, when I try to find the position/occurrence of a blank character in the string using STRPOS, it gives me a 0 (no blank substrings exist)

    I then tried converting my string output into ASCII, and there are ASCII Blank spaces in between. I am really confused as to what is happening

    pastedimage1674612309339v1.png

    Do you know what is happening?

    String Pasted from the Debugger: 1 674 610 728 407

  • Suggested answer
    ajkauffmann Profile Picture
    117 on at

    The Format command includes all signs by default. In your case the thousand delimiter is probably a space.

    The best option is to use an extra parameter to indicate how the decimal should be formatted. The standard XML format will work here:

    Format(UnixDecimal, 0, 9);

    Then you don't need to remove any character afterward.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,926 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,158 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 533 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans