Date format DDMMYYYY and use as Date data type

shanabeywicrema
Member Posts: 53
I need to format the date into DDMMYYY. But want to use as Date, not a text.
This gives me correct formate FORMAT(TODAY,0,'<Day,2>/<Month,2>/<Year4>'); but want to assign to date, when used EVALUATE again my date become DDMMYY.
I am using RecRef therefore need to use same date formate
IF (TableID = 271) AND (BankMapRec."Field No." = 4) THEN BEGIN
EVALUATE(newDate,COPYSTR(FORMAT(RecField,0,'<Day,2>/<Month,2>/<Year4>'),1,2));
RecField.VALUE(newDate);
END;
Can anyone help me to solve this problem? Thank you
This gives me correct formate FORMAT(TODAY,0,'<Day,2>/<Month,2>/<Year4>'); but want to assign to date, when used EVALUATE again my date become DDMMYY.
I am using RecRef therefore need to use same date formate
IF (TableID = 271) AND (BankMapRec."Field No." = 4) THEN BEGIN
EVALUATE(newDate,COPYSTR(FORMAT(RecField,0,'<Day,2>/<Month,2>/<Year4>'),1,2));
RecField.VALUE(newDate);
END;
Can anyone help me to solve this problem? Thank you
0
Answers
-
Separate the FORMAT from the EVALUATE - do it in two steps, and that way you can figure out what's going on in the debugger.
TempText := COPYSTR(FORMAT(RecField,0,'<Day,2>/<Month,2>/<Year4>'),1,2);
EVALUATE(newDate, TempText);
Make sure TempText is what you expect it to be.Kyle Hardin - ArcherPoint1 -
But when I assign to date type again it shows 07/04/20 instead of 07/04/20200
-
Maybe post your whole block of code.
It sounds like you are confusing the initial FORMAT which converts the date in RecField into text, and the final output you want in newDate, which is a date that used EVALUATE to turn the text into a date.
Once you have a valid date in newDate, you will need a second - independent - FORMAT statement to make it look like whatever you want.Kyle Hardin - ArcherPoint0
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