Notifications
Announcements
No record found.
Good day House. Please I am facing a challenge now. I have to assign a "Date" Value to a "DateTime" variable. How do I convert the "Date" to a "DateTime"?
Thanks for your help.
*This post is locked for comments
You can do like this:
YourDateTime := CREATEDATETIME(YourDate,0T);
Hi Demiliani,
thanks for your reply. Yes I tried that before but still could not achieve my aim . What I really want to achieve is setfilter on a DateTime field in a table, now the value to setfilter with is a Date value and am getting error: Conversion is not possible Date:= DateTime.
This is my code:
varEndDate := CREATEDATETIME(EndDate,0T);
SETFILTER(LastDayMonth,'<=%1',CALCDATE('CM', varEndDate));
Note: "LastDayMonth" is a DateTime field from the record(Table) which holds last day of
month for a date.
"EndDate" is a Date value coming from Request page
"varEndDate" is the DateTime variable i am assigning my converted date value so I
can setfilter on my record.
I get the error on the SETFILTER(LastDayMonth,'<=%1',CALCDATE('CM', varEndDate)); lin e that "Conversion is not possible because 1 of the operators contain an invalid type. Date:= DateTime."
Please how can I achieve this filter.
Thanks again.
I think that the problem is in the CALCDATE function. The second parameter must be a Date value.
Hi Toffsam,
Totally agree with Stefano:
"YourDateTime := CREATEDATETIME(YourDate,0T);"
Another way is:
IF EVALUATE(YourDateTime, FORMAT(YourDate)) THEN;
Change a little bit your code:
varEndDate := CREATEDATETIME(CALCDATE('CM', EndDate), 0T);
SETFILTER(LastDayMonth, '<=%1', varEndDate);
Thanks Khoa. It works.
You are welcome, have a nice day!
Hi Khoa,
I sent you an email on this Remote/Part-Time Position.
Thanks.
I replied your email and also added your Skype.
I'm looking for a Remote or Part-Time Position. I have 6 hours/day available and would like to provide it to any company looking for NAV experience person.
DateTime := CREATEDATETIME(Date, Time)
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.