Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

To convert integer to time

Posted on by 4,184

Hi All,

I've converted my time to e.g 11:40:53 to integer variable Hour=11 then Minutes:40 seconds:53 now my question is how to convert the Integer variables to time ?

*This post is locked for comments

  • Verified answer
    CDsilva Profile Picture
    CDsilva 4,184 on at
    RE: To convert integer to time

    I've resolved my issue. I've written a blog on it

    chrisdsilvablog.wordpress.com/.../how-to-restrict-an-action-button-based-on-time-in-microsoft-dynamics-nav

  • Suggested answer
    Saurav.Dhyani Profile Picture
    Saurav.Dhyani 17,965 Super User 2024 Season 2 on at
    RE: To convert integer to time

    Hi,

    In the example above if you use - EVALUATE(MyTime,'114053');

    That means 11 hours, 40 minutes and 53 seconds.

    Try this evaluate statement and let me know how it works.

  • CDsilva Profile Picture
    CDsilva 4,184 on at
    RE: To convert integer to time

    Hi Saurav,

    Thanks,

    I tried EVALAUTE(TimeVar,Hours),

    This works perfectly. But I'm not able to evaluate Minutes and seconds.

    Any suggestion on this?

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: To convert integer to time

    There's no a direct conversion. You need to create a custom function that performs what you want.

    From an integer you can obtain a TIMe in this way:

    message(format(000000T + (YOURINT * 10000)));

  • Suggested answer
    Saurav.Dhyani Profile Picture
    Saurav.Dhyani 17,965 Super User 2024 Season 2 on at
    RE: To convert integer to time

    Hi,

    If you know you parameters of time like -

    1. Hours.

    2. Minutes.

    3. Seconds.

    then you can use  EVALUATE(MyTime,'114053');

    ** Where MyTime is a Time Variable. 

    The System will save value in MyTime variable as - 11:40:53 AM

    ** For NAV it's a 24-hour clock.

    Let me know if any questions.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans