Return only date in create dateandtime field [Moderator Subject Edit]

I want to get only date , in create dateandtime field how to get through code?

Hi Sowjanya,

try this…

static void dateJob(Args _args)


date currentDate = today();

str s;


s = date2Str (currentDate, 123, DateDay::Digits2, DateSeparator::Dot, // separator1

DateMonth::Short, DateSeparator::Dot, // separator2

DateYear::Digits2 );

info("Today is: " + s)



Hi Sowjanya,try this code

date d; ;


print “today date is” +date2Str(d,0,2,-1,2,-1,4);

try using datetimeutil::date(utcdatetime)


This was discussed quite a few times already. Ex -

In future, please do a search before you post your queries [:)]

Please make your subject post descriptive next time.