Time in HH:MM:SS format

sunnyk
Member Posts: 280
Greetings,
How can we convert TIME into HH:MM:SS format. I mean if the Time is 5:45:23 AM then it should come as 05:45:23 and if the TIME is 5:45:23 PM then it should come as 17:45:23. Using DELCHAR i am able to delete AM and PM from TIME but how to add extra 0 if any of the hour/min/seconds are in Single Digit. We can have DATE2DMY to get Year, Month and Day from the Date. But, How can we do this for the TIME.
How can we convert TIME into HH:MM:SS format. I mean if the Time is 5:45:23 AM then it should come as 05:45:23 and if the TIME is 5:45:23 PM then it should come as 17:45:23. Using DELCHAR i am able to delete AM and PM from TIME but how to add extra 0 if any of the hour/min/seconds are in Single Digit. We can have DATE2DMY to get Year, Month and Day from the Date. But, How can we do this for the TIME.
0
Comments
-
Any Suggestions?0
-
Are you able to get the time in a variable of type Time?
I read that you were able to remove the AM/PM part so you can do a evaluate with the other part link this:
EVALUATE(Time2, '5:45:23');
Then you can use the following format command:
FORMAT(Time2, 0, '<Hours24,2><Filler Character,0>:<Minutes,2>:<Seconds,2>');Reijer Molenaar
Object Manager0 -
Take a look to the FORMAT function.
Go to C/AL Symbol Menuy -> System -> Variables -> Format -> press then F1 and read there also the HELP behind the Hyperlink (FORMAT property).
There u will find examples like this:
Time / Format / Example
<Hours24>.<Minutes,2>.<Seconds,2> / 0 / 4.35.55
<Hours24>.<Minutes,2>.<Seconds,2><Second dec.> / 1 / 4.35.55.553Do you make it right, it works too!0 -
Thanks Rene, This is exactly what i want. =D>0
-
Is it really faster to post a question than to Press F1? :whistle:David Singleton0
-
Please and welcome.
And don't forgett (and don't missunderstood me)
.
1. Use the brain ;-)
2. use the help (step 1 must also be run :-) ) <- it's very powerfull
3. search the forum <- if you doesn't found anything in the help
4. create a question, if 1,2 and 3 doesn't bring you to your goal ;-)
RegardsDo you make it right, it works too!1 -
Use the Evaluate Function it will simply convert the date or time to specific date or time format
Ex. :- EVALUATE(RealDate,'19022018'); // For Any Date which you want to convert (19-Feb-2018)
EVALUATE(RealTime,'142930'); // For Any Date which you want to convert (14:29:30)1
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions