Getting Monday of a particular week
sabzam
Member Posts: 1,149
Dear all,
I need to get the date of a Monday of a particular week. How could I get it from Nav?
I need to get the date of a Monday of a particular week. How could I get it from Nav?
0
Comments
-
Use the function DWY2DATE.
From NAV Help:
DWY2DATE (Date)
Use this function to return a Date based on a weekday, a week, and a year
Salut!Laura Nicolàs
Author of the book Implementing Dynamics NAV 2013
Cursos Dynamics NAV (spanish) : http://clipdynamics.com/ - A new lesson released every day.0 -
Perhaps you should have a look at the function CALCDATE. For example CALCDATE('<-CW>',TODAY) would return the date of Monday in the current week. The parameter TODAY can be exchanged with any other date to get the date of Monday in that particular week.0
-
I wonder if both CALCDATE and DWY2DATE would help you if I read
as knowing a week number and wanting to determine the date of the Monday in that week.sabzam wrote:... date of a Monday of a particular week...
If that's the case I would use the Date table to find out.0 -
You can also find it out using the Date table, but it will take longer than using the function.
Try thisWeekNo := 4; Year := 2010; VarTime[1] := TIME; Date2.SETRANGE("Period Type",Date2."Period Type"::Year); Date2.SETRANGE(Date2."Period No.",Year); Date2.FINDFIRST; Date.SETRANGE("Period Type",Date."Period Type"::Week); Date.SETRANGE("Period Start",Date2."Period Start",Date2."Period End"); Date.SETRANGE("Period No.",WeekNo); Date.FINDFIRST; ResultDate[1] := Date."Period Start"; VarTime[2] := TIME; VarTime[3] := TIME; ResultDate[2] := DWY2DATE(1,WeekNo,Year); VarTime[4] := TIME; MESSAGE('Date Table %1 %2\DWY2DATE %3 %4', ResultDate[1], VarTime[2]-VarTime[1], ResultDate[2], VarTime[4]-VarTime[3]);
Salut!Laura Nicolàs
Author of the book Implementing Dynamics NAV 2013
Cursos Dynamics NAV (spanish) : http://clipdynamics.com/ - A new lesson released every day.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 328 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

