Premahari
21st January 2019, 09:24
Hi, In my form i have passed year and period, I want to know the start date for that period. Because for my company period 1 is April. If i pass period 1 and use function like date.utc() it will give january 1st date. When i try to get start date from periods session its returning some other date 09.01.1970.. I have used below code.

select tfgld005.*
from tfgld005
where tfgld005._index1 = {1,:year,:perd.f}
selectdo
date.f = tfgld005.stdt
endselect

tmannais
21st January 2019, 10:35
I think it is because your tfgld005.stdt comes out as a local datetime.
Try

long utc.tfgld005.stdt
local.to.utc(tfgld005.stdt, 0, utc.tfgld005.stdt)

to convert local datetime into utc datetime.
In this example, you can use the variable utc.tfgld005.stdt as the output.
See if that is the case.

Ajesh
21st January 2019, 11:21
function extern boolean tfgld.dll5005.get.date.based.on.period.and.year(
domain tcncmp i.company,
domain tfgld.ptyp i.period.type,
domain tfgld.year i.year,
domain tfgld.prod i.period,
ref domain tfgld.date o.date)

Premahari
21st January 2019, 11:37
Thank you very much tmannais.. After using function local.to.utc() it's working.