11.09.2012, 18:11 | #1 |
Участник
|
ax-erp: How to extract Date value from a DateTime field
Источник: http://microsoft-dynamics-ax-erp.blo...-datetime.html
============== In this post I show how to extract Date value from a DateTime field. To do this, we need to use System.DateTime. Please refer to the sample Job below. It will retrieve a Date value from createdDateTime field on a purchaseOrder record. static void getDate(Args _args){ System.DateTime _dateTime; Date _date; PurchTable _purchTable; ; _purchTable = PurchTable::find("PO000008"); _dateTime = System.DateTime::Parse(dateTime2str(_purchTable.createdDateTime)); _date = _dateTime.get_Date(); info(date2str(_date,-1,-1,-1,-1,-1,-1)); } Note: if you get "Request for the permission of type 'InteropPermission' failed." error, you need to use InteropPermission class: static void getDate(Args _args) { System.DateTime _dateTime; Date _date; PurchTable _purchTable; InteropPermission intPerm = new InteropPermission(InteropKind::ClrInterop); ; _purchTable = PurchTable::find("PO000008"); intPerm.assert(); _dateTime = System.DateTime::Parse(dateTime2str(_purchTable.createdDateTime)); _date = _dateTime.get_Date(); CodeAccessPermission::revertAssert(); info(date2str(_date,-1,-1,-1,-1,-1,-1)); } Источник: http://microsoft-dynamics-ax-erp.blo...-datetime.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|