Skip to main content

Notifications

Power Pages - General Discussions
Suggested answer

Retrieve the data in IST form using liquid code

(0) ShareShare
ReportReport
Posted on by

I am trying to Retrieve data of date and time column in the power pages. The time that is saved in IST format in Dataverse is not retrieving in the same format, istead getting it in the UTC time.I want show that in the IST 

The following solutions are not working:

{{attendanceresult.basofa_logout | date:"hh:mm:ss" | plus: 19800 }}

{{attendanceresult.basofa_logout | date:"  hh:mm" | date: '+05:30'}}

{{ attendanceresult.basofa_logout | in_time_zone: "IST" | date: "hh:mm" }}

Categories:
  • Suggested answer
    abm abm Profile Picture
    abm abm 32,296 on at
    Retrieve the data in IST form using liquid code
    Hi
     
    You could try using a Jscript
     
    function convertToLocalTime(utcDate, timeZone) {
        // Convert the UTC date to a Date object
        const date = new Date(utcDate);
        // Convert the UTC date to the local time of the specified time zone
        const localDateTime = date.toLocaleString("en-US", {
            timeZone: timeZone,
            year: 'numeric',
            month: '2-digit',
            day: '2-digit',
            hour: '2-digit',
            minute: '2-digit',
            second: '2-digit',
            hour12: false // 24-hour format
        });
        return localDateTime;
    }
     
     
    // Get the current date in UTC format
    const utcDate = new Date().toISOString(); // Today's date in UTC
    const timeZone = "Asia/Kolkata"; // Indian Standard Time (IST) timezone
    const localDateTime = convertToLocalTime(utcDate, timeZone);
    console.log("UTC Date:", utcDate);
    console.log("Local Date Time:", localDateTime);
     
     
    Above replace the utcDate with your date.
     
    Thanks
  • Suggested answer
    Inogic Profile Picture
    Inogic 901 on at
    Retrieve the data in IST form using liquid code
    Hi,
     
    We understand that you are looking to retrieve the Created On field in IST format within a Power Pages webpage.
    Currently, Liquid can retrieve the date value, but it cannot directly fetch the formatted value. You can refer to the screenshot below for further clarification.

    However, you can still achieve this by either:
    1. Utilizing Liquid's date functions to adjust the time by adding the required hours for IST.
    2. Leveraging the Power Pages Web API to retrieve the formatted values in IST directly.
    Hope this helps.
     

    Thanks!

    Inogic Professional Services: Power Platform/Dynamics 365 CRM
    An expert technical extension for your techno-functional business needs
    Drop an email at crm@inogic.com 
    Service: https://www.inogic.com/services/ 
    Tips and Tricks: https://www.inogic.com/blog/ 
  • Suggested answer
    Siranga Gamage Profile Picture
    Siranga Gamage 4 on at
    Retrieve the data in IST form using liquid code
    I had the same question a few weeks ago, and from my research, it seems that Liquid doesn't have functionality for that. The only option I found is using the "add hours" filter, if that works for your needs.

    {{ now | date_add_hours: 1 }}
  • Suggested answer
    Fubar Profile Picture
    Fubar 7,688 on at
    Retrieve the data in IST form using liquid code
    Not sure what's going on, I replied to this post and then it disappeared.
     
    I don't believe there is a timezone setting, but you can add days, hours etc to a date field in liquid see the date filters https://learn.microsoft.com/en-us/power-pages/configure/liquid/liquid-filters#date-filters

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard