Convert Date to Text

attardc
Member Posts: 97
Now I have a Date field which I'd like to convert it or copy it into another variable of the type Text. !!
I'm using MS Dynamics NAV 5.
Any help appreciated!
I'm using MS Dynamics NAV 5.
Any help appreciated!
0
Comments
-
Date : Dt
Text : Txt
Txt := Format(Dt); -- this code will convert Date field to Text.0 -
There is quite much possible with the FORMAT-statement. Just look for the format statement and property in the help.Here are some examples of how to use the Format property:
Choosing a standard format:
Use the Standard Format attribute to select one of the standard formats (these are listed at the end of this Help topic).
For example, <Standard Format,5> will select Standard Format 5.
Using a standard format with an attribute:
<Precision,2:3><Standard Format,0> will use Standard Format 0 and will format the data with a minimum of 2 and a maximum of 3 decimal places. See also the DecimalPlaces property. If you do not specify any precision the form will use the precision specified in the Decimal Places property of the corresponding field in the table.
Building a Format
You can create your own formats by using Chars (which will be displayed literally), Fields (to choose specific components of a value, for example the year-part of a date) and Attributes (for example to select which character to use as a filler).
For example, a text box based on a source expression of the Date data type, that uses the following format string:
<Weekday Text>, <Month Text> <Day>
will display the date as: Monday, April 150 -
Hey guys,
DO NOT forget standard codeunit 6201 Conventions, You will get a shock0 -
DateToText(VarDate : Date) : Text[8]
IF VarDate = 0D THEN VarText := '17530101' ELSE VarText := FORMAT(VarDate,0,'<Year4><Month,2><Day,2>'); EXIT(VarText);
wth, could not they at least check for MS SQL option with RECORDLEVELLOCKING function before setting 1753.01.01 ?0 -
Instead of spending lots of time to figure out how to write some critical basic functions I would prefer to figurre out how Navision handle them now. As much as I can. Until today, there are many many useful functions which are integrated into standard codeunits, we can use them as much as we can and spend time on business logic coding. Actually, "reading codeunits" is very helpful for me, I found lots of useful staff within Navision.
Good Luck,0 -
in fact, the book of David Studebaker "Programming MS Dynamics NAV" handles some useful codeunits:
http://www.packtpub.com/Microsoft-.NET- ... ision/book0
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