Get join date as per user preferred time zone

Hi,

we recently came across one issues on getting date from database, in Ax 2012 the data time concept is introduced for the more active storing of data. when are try to get the join date for the employee through x++ code, we will get the date as per the central time zone stored in data base.

To get it based on the user preferred time zone use below sample code: 

JoinDateEmpl = DateTimeUtil::applyTimeZoneOffset( hcmEmployment::findByWorker(_worker).ValidFrom, DateTimeUtil::getUserPreferredTimeZone());

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s