about date format
bangswit
Member Posts: 265
hi all... i have some questions about date format
1. how to read 20100614 to be read as a date?
2. if there is no data , i want it is filled by date of today
is it correct to be like this?
Thanks
1. how to read 20100614 to be read as a date?
2. if there is no data , i want it is filled by date of today
is it correct to be like this?
IF STRLEN(DocumentDateText)=0 THEN
EVALUATE(DocumentDate,'TODAY')
ELSE
EVALUATE(DocumentDate,DocumentDateText);
Thanks
0
Answers
-
use this....
IF STRLEN(DocumentDateText)=0 THEN DocumentDate := TODAY ELSE EVALUATE(DocumentDate,DocumentDateText);0 -
error mesage20100614 is not a valid date0
-
Check the system settings for your error message....!!!Thanks,
Kashyap0 -
bangswit
Try to use function DMY2DATE.
But you need to cut and covert to integer your string before.
regards,
Depro0 -
what are you exactly doing is importing data or displaying report?
need some clearification.
describe your code here with trigger name.0 -
on which trigger you are writing code and in dataport field what you have defined for this field?0
-
vijay_g wrote:on which trigger you are writing code and in dataport field what you have defined for this field?
i'm using report
Report - OnPostReport()
DocumentDate := 101310D;
DocumentDateText1 := FORMAT(DocumentDate,0,'<Year4><Month,2><Day,2>');
MESSAGE('%1',DocumentDateText1);
--> it will show you 20101013
so... how to reverse it?
from 20101013 became read in date type0 -
bangswit wrote:depro wrote:bangswit
Try to use function DMY2DATE.
But you need to cut and covert to integer your string before.
regards,
Depro
you mean separate with 3 strings ??
20100614 become
string1 --> 2010
string2 --> 06
string3 --> 14
is it like this?
the easy way , create a function as follow ....
e.g. ConvertDate(DocumentDateText : Text[50]) : Date
EVALUATE(vYear,COPYSTR(DocumentDateText,1,4));
EVALUATE(vMonth,COPYSTR(DocumentDateText,5,2));
EVALUATE(vDay,COPYSTR(DocumentDateText,7,2));
EXIT(DMY2DATE(vDay,vMonth,vYear));END is well that all is well ~~~0 -
impotence wrote:bangswit wrote:depro wrote:bangswit
Try to use function DMY2DATE.
But you need to cut and covert to integer your string before.
regards,
Depro
you mean separate with 3 strings ??
20100614 become
string1 --> 2010
string2 --> 06
string3 --> 14
is it like this?
the easy way , create a function as follow ....
e.g. ConvertDate(DocumentDateText : Text[50]) : Date
EVALUATE(vYear,COPYSTR(DocumentDateText,1,4));
EVALUATE(vMonth,COPYSTR(DocumentDateText,5,2));
EVALUATE(vDay,COPYSTR(DocumentDateText,7,2));
EXIT(DMY2DATE(vDay,vMonth,vYear));
is it valid for comp using DDMMYYYY and MMDDYYY ???
or should i set the comp to be DDMMYYYY ?0 -
if you want to using the other date format (DDMMYYYY or MMDDYYYY) , you should edit the code or create the other functions.END is well that all is well ~~~0
-
Hello,
DMY2Date is a function that will create a date from you day, month and year.
So the system will show you the date, in the format that is already set.
So dont worry, if your format is set to DDMMYYYY or MMDDYYYY then the system will show you date like 14/06/10 or 06/14/10 respectively...!!!Thanks,
Kashyap0 -
yap!
those codes working !!
thanks all
0 -
how to get "NOW"??
FORMAT(TODAY,0,'<Year4><Month,2><Day,2>') --> today
how to get like this 01012010123055 -> date + time
thanks0 -
FORMAT(CURRENTDATETIME,0,'<Day,2><Month,2><Year4><Hours><Minutes>')
Try to use YYYYMMDDHHmm rather than DDMMYYYYHHmm or MMDDYYYHHmm if you can. It is much more logical and sorts correctly.0
Categories
- All Categories
- 75 General
- 75 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
