web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Pulling a date time fi...
Power Automate
Unanswered

Pulling a date time field only wanting the date only

(0) ShareShare
ReportReport
Posted on by 156

Hi,

 

I am looking at a form using a HTTP Request [date] has a date time field and comparing the variable I only want the date so it will bring in "todays" data only . 

mezcalbean_0-1645593772154.png

 

 

mezcalbean_2-1645593867727.png

I was trying to formatdatetime but was unsure how to compare with the above variable the the HTTP request

 

any help appreciated 

 

Regards

 

 

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @mezcalbean,

     

    What is in the beginning of your expression in the Initialize variable action with the name Date?

     

    Have you tried using a utcNow function? If not, try something like below:

    utcNow('yyyy-MM-dd')

     

  • mezcalbean Profile Picture
    156 on at

    Hi @Expiscornovus - What I was asking was gibberish. I looked at it yesterday and I was trying to manipulate the variable with the date which was incorrect.

     

    The HTTP request is pulling in a date time filed [date] below image. What I need to do is look back one day and look for the whole date and time 

     

    mezcalbean_2-1645593867727.png

    So the http request pulls in "date""2020-11-18 09:54",

     

    So I nee to work out the variable below how to encompass date between -1 day, so all of yesterdays date and time
    mezcalbean_0-1645593772154.png
     
    I do know the formula  is incorrect as this it only looking at a date only
     
    The goal is to limit records so it only brings in yesterdays results
     
    Thanks for your help
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @mezcalbean,

     

    You could use an adddays function with -1. In combination with UTCNow this should give you yesterday. You can also manipulate the formatting to whatever you want (and for example include the time).

     

    Can you try this expression instead?

     

    addDays(utcNow(),-1, 'yyyy-MM-dd HH:mm')

     

     

    yesterday_expression.png

  • mezcalbean Profile Picture
    156 on at

    Hi @Expiscornovus ,

     
    I am trying to compare a date and a time so this is my UTC now using your example the value its looking at is 2022-02-27 04:29
     
    mezcalbean_1-1646022607948.png

     

    My record which is the HTTP record is dataAccessGroups=false&returnFormat=json&filterLogic=[date]='@{variables('Date')}'

    mezcalbean_2-1646022680203.png

     

    so the record will to match the variable 2022-02-27 04:29 which it wont unless its run and matched exactly at the same date and time.

     

    Can i put a variable in two compare two dates and time - only time like formatDateTime(addDays(utcNow(),-1),'dd-MMMM-yyyy-00-00-00'which gives me 27-February-2022-00-00-00 This gives me yesterday day and at a forced time of 00:00:00- I then need another variable to say from formatDateTime(addDays(utcNow(),-1),'dd-MMMM-yyyy-23-59-59') to see if it would look at and record in theta date 

     

    OR.... with he HTTP pull instead of = can you put less than <= , I have tried without luck?

    mezcalbean_3-1646023353967.png

    edit

    needing to highlight the record has a "now timestamp" within the logic which is part of the [date] - body part of the record

     

    Thank you

     

     

     

     

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @mezcalbean,

     

    What you need to input in the body depends on what API your are interacting with. I don't know what type of filters this unknown API supports 😄

     

    Do you by any chance have a link to API documentation or can you share which application your interacting with?

     

    Regarding the date formatting in Power Automate. You can just hardcode the time. 

     

    Below are two examples:

     

    addDays(utcNow(),-1, 'yyyy-MM-dd 00:00')

     

    addDays(utcNow(),-1, 'yyyy-MM-dd 23:59')

    hardcodetime_informatting.png

  • mezcalbean Profile Picture
    156 on at

    Hi @Expiscornovus 

     

    firstly thank you for staying with me 😁

     

    That API filter is [date] (which refers to a field within the form) when the record was created which is a time date field coming from the record.

     

    Documentation on the web refers to REDCap

    getfile.asp (illinois.edu)

    I am exporting records the [date] refers to 

    filterLogic
    String of logic text (e.g., [age] > 30) for filtering the data to be returned by this API method, in which the API will only return the records (or record-events, if a longitudinal project) where the logic evaluates as TRUE. This parameter is blank/null by default unless a value is supplied. Please note that if the filter logic contains any incorrect syntax, the API will respond with an error message.

     

    The base of the parameters is

    Required

    token
    The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project.
    content
    record
    format
    csv, json, xml [default], odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1)
    type
    • flat - output as one record per row [default]
    • eav - output as one data point per row
      • Non-longitudinal: Will have the fields - record*, field_name, value
      • Longitudinal: Will have the fields - record*, field_name, value, redcap_event_name
    * 'record' refers to the record ID for the project
     
    mezcalbean_2-1645593867727.png
     
    Using you two variables how would combine that in the flow?
     
    Adding context to this if the forms [date] field was a date it would be no issue as
    [date](date of form) = 'Variable' (convertTimeZone(utcNow(),'UTC','Singapore Standard Time')
     
    this works as todays date equals todays date on the record and passes through...
     
    Regards

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard