cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
XAEA12
Frequent Visitor

Date text create universal format

I have a small app /form with a date text field which locks in the current date (syntax: Text(Today(), DateTimeFormat.ShortDate). Once the form is submitted it triggers a Power Automate workflow which writes all necessary info in a SharePoint list. I use the DateTimeZone.Local on the Date picker , but for some users, since they have a different time format (such as dd.mm.yyyy) it fails to write the information in the SharePoint list since it expects a specific format (mm/dd/yyyy). Tried also with DateTimeZone.UTC and converting the time zone in the Power Autoamte workflow, but it always shows yesterday's date.

Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
FabianAckeret
Solution Sage
Solution Sage

Hi @XAEA12 

 

In Power Automate, in your SelectedDate variable, try the following:

  • Click on the empty variable field
  • Click on Expression
  • type in (& adjust date): formatDateTime(<your date>, 'MM/dd/yyyy')

Does this work? 

 

Kind regards,

Fabian

 


Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

View solution in original post

4 REPLIES 4
FabianAckeret
Solution Sage
Solution Sage

Hi @XAEA12 

Date fields can be a bit tricky due to the different time zones and the time (not date) stamp that is being submitted as well. For me its also always a try and error... 🙂

 

Does it work if you try the following?

DateAdd(Today(),-TimeZoneOffset(),Minutes)

 

For troubleshooting purposes, if you add your date to a label, you might see that it actually sets the date to midnight. Often times this will then be the next day. 

 

Besides above, try to add your date with the Date function. Like so:

Date(Text(Today(),'yyyy'), Text(Today(),'mm'),Text(Today(),'dd'))

// alternatively, you can also do this:
Date(Year(Today()), Month(Today()), Day(Today()))

 

I hope this helps.

Kind regards,

 


Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.
XAEA12
Frequent Visitor

Thanks for your input. Tried both ways, with no luck.

The date format looks ok visually, but when it's passed into a variable to Power Automate the format is still faulty. I made a few screenshots.

Date Picker settings:

XAEA12_0-1609759184607.png

Displayed date in the app:

2.PNG

The variable in Power Automate sent from the App:

3.PNG

 

FabianAckeret
Solution Sage
Solution Sage

Hi @XAEA12 

 

In Power Automate, in your SelectedDate variable, try the following:

  • Click on the empty variable field
  • Click on Expression
  • type in (& adjust date): formatDateTime(<your date>, 'MM/dd/yyyy')

Does this work? 

 

Kind regards,

Fabian

 


Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.
v-xiaochen-msft
Community Support
Community Support

Hi @XAEA12 ,

 

Could you tell me:
Has the problem been solved?
Is there anything else I can help?

If your problem has been solved, please consider accept user’s post as a solution to help others. Thanks.

 

Best Regards,

Wearsky

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,153)