JanePapa
20th May 2019, 09:27
Hi all,

I need to get start date of last week & end date of last week.

Trigger of program: I run schedule on Monday of this week and in my program need to get the dates and above.

Could you please to advise me about how to coding or any functions that I can use?

Many Thanks, :)

mark_h
20th May 2019, 14:23
Depends on what you call first day of the week - see this thread for some options on getting first day of the week - http://www.baanboard.com/baanboard/showthread.php?t=1524&highlight=start+date+week. The last day of the week can be start date +5 or how ever you want to define it.

bdittmar
20th May 2019, 15:08
Hello,
why not using calender functionality from tcccp.

Periodtable WEEK (tcccp0170m000)
2019
Period Begin End
1 01.01.2019 00:00:00 08.01.2019 00:00:00
2 08.01.2019 00:00:00 15.01.2019 00:00:00
3 15.01.2019 00:00:00 22.01.2019 00.00.00
a.s.o.

and use tcccpdll070

domain tcdate
tcccp.dll0070.get.first.period.start.date( domain tcccp.cpdt i.period.table.code, domain tcccp.yrno i.year )

domain tcdate
tcccp.dll0070.get.last.period.end.date( domain tcccp.cpdt i.period.table.code, domain tcccp.yrno i.year )


Regards

JanePapa
21st May 2019, 06:30
Hi Mark and Bernd,

Thank you for your support.
I used the solution with both reply to find the start-date and end-date.

Thanks.

JanePapa
21st May 2019, 09:55
Hello,
why not using calender functionality from tcccp.

Periodtable WEEK (tcccp0170m000)
2019
Period Begin End
1 01.01.2019 00:00:00 08.01.2019 00:00:00
2 08.01.2019 00:00:00 15.01.2019 00:00:00
3 15.01.2019 00:00:00 22.01.2019 00.00.00
a.s.o.

and use tcccpdll070

domain tcdate
tcccp.dll0070.get.first.period.start.date( domain tcccp.cpdt i.period.table.code, domain tcccp.yrno i.year )

domain tcdate
tcccp.dll0070.get.last.period.end.date( domain tcccp.cpdt i.period.table.code, domain tcccp.yrno i.year )


Regards

Hi Bernd,

When I used.. tcccpdll0070
domain tcdate startdate

In database keep the data 2019-05-20 06:00:00
but after I used function as your recommend I got only date (no include time 06:00:00)
this data shown on screen startdate = 2019-05-20T00:00:00+01:00 [UTC]

Could you please to advise?

Thanks,