We are creating a page where components are fetched on page using broker DB query and are being published from CMS. And for each component, there is a need to get the difference between the published time for the component and current time.
The current server time is being captured at the page level using DateTime.Now syntax while the published time for each component is taken using the same code at component level C# TBB. The difference between the two values is to be shown on the page for each component. Thus, this calculation needs to be done at component level TBB. A scriptlet, where this difference is evaluated, is written at component level TBB.
But since the components are appearing dynamically on the page, the scriptlet doesn't get evaluated and appears as plain text on the page. Scriplet code is as
DateTime diff= pageTime - componentTime ;
pageTime is a variable that captures the current server time and is present in page TBB and componentTime is the variable that captures the component published time in component TBB. and this line is written inside a component TBB since this calculation is required for each component on page.
Is there any way to achieve this? Any help will be much appreciated..