DMY2DATE for year 2010 error!!!

euekim
Member Posts: 21
Hi,
i check the DMY2DATE function in Outlook Synch. Type Conversion and it gives me the wrong date
sample date is 02/12/10
Day := 12
Month := 02
Year := 10
when i used
DateVar := DMY2DATE(Day,Month,Year);
it return
2/12/0010
i assuming its 2/12/10
i check the DMY2DATE function in Outlook Synch. Type Conversion and it gives me the wrong date
sample date is 02/12/10
Day := 12
Month := 02
Year := 10
when i used
DateVar := DMY2DATE(Day,Month,Year);
it return
2/12/0010
i assuming its 2/12/10

Thinking, programming, coding, developing == Music!
0
Comments
-
Hi
I always use parameter "year" in function DMY2DATE as 4 number year , so:Day := 12
Month := 02
Year := 10
DateVar := DMY2DATE(Day,Month,Year);
Just use insteadDay := 12
Month := 02
Year := 2010
DateVar := DMY2DATE(Day,Month,Year);
Form C-Side help about Year Parameter:
Year
Data type: integer
The four-digit number of the year. If you omit this optional parameter, the system uses the current year as the default.0 -
you can try JedrzejT
Anyways, did you can change the regional and language setting for your PC? change the date formats to dd/MM/yyyy and try it again?0 -
Hi,
I like to use function in way that i know it works fine. If 2 digit can produce some problem in some situations i prefer to not used it... not a big deal using 4 digit. When you use 2 digit? When you hardcode something - so it is wrong in other way0 -
JedrzejT wrote:I like to use function in way that i know it works fine. If 2 digit can produce some problem in some situations i prefer to not used it... not a big deal using 4 digit.
Exactly. If you know 2 digits doesn't work, use 4 digits. It's not a big deal.
It's good to know that it is an issue though, something to look for if the issue ever comes up :thumbsup:0 -
Yeah, the help says specifically to use a four digit year. If you choose not to you do so at your own risk.0
-
I have always used 4 digits, I can't see any reason to expect 2 digits to work, that is only for the UI entry. I once had a dataport importing from a Unix system that had 2 digit years and this was in 1998, so I created code to pseudo intelligently work out the 1900 or 2000 to add to the year to make it work.
Has it ever been possible to use a 2 digit date? I just can't see how you can expect this if the parameter is an integer. If it was text, then there might be an assumption that it uses the same parser as the UI, but not integer. In fact if it allowed 2 digits, that would automatically exclude all years form 0 to 999 since integers automatically strip the leading zeros (obviously) so it the integers 0099 and 99 are identical.
Sorry to be pedantic, but I just don;t see this as an error, not even a so called "undocumented feature". I see this as exactly how the function should work.David Singleton0 -
hi guys
thanks for your reply, and sorry for my late response.
:thumbsup:Thinking, programming, coding, developing == Music!0
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