Problem with utcdatime from external db

Hi,

I have class that read some data from external database and save it into the axapta. One of the columns is DateTime, so i use:

uc = resultSet.getDateTime(2);

myTable.DateTimeStop = uc;

myTable.update();

But when I save uc into MyTable.DateTimeStop and I open form there is bad time. I know that I should use DateTimeUtil::applyTimeZoneOffset.

I tried DateTimeUtil::time(DateTimeUtil::applyTimeZoneOffset(uc, DateTimeUtil::getUserPreferredTimeZone()));

but this is wrong.

Please, can somebody hlep me?

Hi,

For this to work, you should be receiving DateTime value in ‘uc’ variable.

If you just receive Date element i.e. without time, then you can use ‘newDateTime’ method. Ex -

DateTimeUtil::newDateTime(systemdateget(), timenow(),Timezone::GMT_DUBLIN_EDINBURGH_LISBON_LONDON)));

Thank you for your reply.

I forgot variable uc is utcdatetime. In external db is DateTime without timezone.