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

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

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