SBX - Search With Button

SBX - Forum Post Title

Employee joining date

Microsoft Dynamics AX Forum

MAKDAX2012_Ahmed asked a question on 17 May 2019 3:41 AM

Question Status

Verified

Hi Guys

I am facing a problem getting employee joining date in DAX 2012 R3 HR module.

when get employee joining date by T-SQL query it show me one day previous(Back date) date in T-SQL result i.e AX date of joining =

SQL date of joining  

please help me

Reply

Hi,

What exactly is the problem and what do you try to achieve exactly?

Would be great if you could provide some additional information and write a bit more :-) to fully understand what the underlying issue is.

Many thanks and best regards,

Ludwig

Reply
Satish Panwar responded on 17 May 2019 8:40 AM
My Badges
Verified Answer

The date in SQL is in utc timezone. you need to apply timezone offset based on user and then you will get the correct date from T-sql.

Reply
MAKDAX2012_Ahmed responded on 17 May 2019 12:01 PM

i have solved by adddate(hour,5,validdate) from hcmemployement

Reply
MAKDAX2012_Ahmed responded on 17 May 2019 12:03 PM

any example please

Reply
Verified Answer

You used correct  SQL function  dateadd.

SQL-  dateadd(hour, -8, assign.validTo)

AX-  DateTimeUtil::newDateTime(DateTimeUtil::date(this.EmploymentValidTo),86399,Timezone::GMTMINUS0800PACIFICTIME);

Reply
Satish Panwar responded on 17 May 2019 2:18 PM
My Badges
Suggested Answer

select top 1 CREATEDDATETIME SQLTime,  

 CONVERT(datetime,

              SWITCHOFFSET(CONVERT(datetimeoffset, CREATEDDATETIME),

DATENAME(TzOffset, CREATEDDATETIME  AT TIME ZONE 'Pacific Standard Time')))

AS UI_Time from CUSTTABLE where DATAAREAID = 'usmf'

SQL time = 2013-01-03 11:58:40.000

My timezone is pacific

UI_Time - 2013-01-03 03:58:40.000 (D365 shows same).

There are multiple ways of achieving the same result, you need to find which one you want to use.

Reply
Satish Panwar responded on 17 May 2019 4:56 PM
My Badges

Hi MAKDAX2012_Ahmed..If your question has been resolved, please take time to verify the answer.

Reply
Satish Panwar responded on 17 May 2019 8:40 AM
My Badges
Verified Answer

The date in SQL is in utc timezone. you need to apply timezone offset based on user and then you will get the correct date from T-sql.

Reply
Verified Answer

You used correct  SQL function  dateadd.

SQL-  dateadd(hour, -8, assign.validTo)

AX-  DateTimeUtil::newDateTime(DateTimeUtil::date(this.EmploymentValidTo),86399,Timezone::GMTMINUS0800PACIFICTIME);

Reply
Satish Panwar responded on 17 May 2019 2:18 PM
My Badges
Suggested Answer

select top 1 CREATEDDATETIME SQLTime,  

 CONVERT(datetime,

              SWITCHOFFSET(CONVERT(datetimeoffset, CREATEDDATETIME),

DATENAME(TzOffset, CREATEDDATETIME  AT TIME ZONE 'Pacific Standard Time')))

AS UI_Time from CUSTTABLE where DATAAREAID = 'usmf'

SQL time = 2013-01-03 11:58:40.000

My timezone is pacific

UI_Time - 2013-01-03 03:58:40.000 (D365 shows same).

There are multiple ways of achieving the same result, you need to find which one you want to use.

Reply

SBX - Two Col Forum

SBX - Migrated JS