Split DateTime

Hi,

How to split datetime in ax? I want extract the Customer details into Excel which is the created date from 1st July 2012 until 30 Dec 2012. But the problem is, in the CustTable for created date has combined with time. So i just want to take the date only to put in SQL syntax. Please help me…

7610.2013-04-10_112351.png

use the below code

date d;

tablename tableobject;

d = DateTimeUtil::date(tableobject.createddatetime);

info(strFmt("%1",d));

Thanks for trying to help me. Btw, i already got the solution.

#File
CommaIO cio_write;
CustTable custTable;
container con;
Counter intCount = 0;
TransDate fromDate,toDate;
TimeZone tz;
UtcDateTime fDateTime,tDateTime;
;

fromDate = mkDate(1,07,2012);
toDate = mkDate(30,12,2012);
fDateTime = Global::datetobeginUtcDateTime(fromDate,tz);
tDateTime = Global::datetobeginUtcDateTime(toDate,tz);

//declaration for using IO to create a csv file
cio_write = new CommaIO(“E:\IDimension\Customer\CustTable.csv”, #io_write);

con += ‘AccountNum’;
con += ‘Name’;
con += ‘Address’;
con += ‘Currency’;
con += ‘Created Date Time’;

cio_write.write(con);

//select vendTable
while select custTable where custTable.createdDateTime >= fDateTime

&& custTable.createdDateTime <= tDateTime
{
// contain all information in vend table in this container
con = [
custTable.AccountNum,
custTable.Name,
custTable.Address,
custTable.Currency,
custTable.createdDateTime

];

//write the information in container into csv file
cio_write.write(con);
con = connull();
intCount++;
}