Hi PowerUsers,
I'd like to know what is the default date format of powerapps and on what elements its based on (Web or Local machine datetime) ?
The issue I am facing is, when I read data from SQL in powerapps through gallery the date format it shows is "mm/dd/yyyy" whereas in SQL I have date format as "yyyy-mm-dd".
I am aware of the fact that I can change the formats by using Text() function but as per my scenario I can not typecast the dates into text.
I'd like to know if I can change the default date format of powerApps somehow ?
I want it to read the dates in "yyyy/mm/dd" format by default without any typecasting or conversion.
A little scenario is, I have a column named PERIODSTARTDATE in SQL which is of datetime type.
In powerApps I was comparing it with function Today() to extract certain set of record but now it has stopped working due to the date format as today is 06/01/2020 and somehow powerapps is reading it as 6th January 2020.
Things are getting messed up as I am using such comparisons in lots of places within my applications.
Looking forward to helpful responses as usual.
Best Regards,
Ali Nawaz
Solved! Go to Solution.
Hi @Anonymous ,
Firstly, I'm afraid it's not supported to change the default date format in powerapps. It is set by system automatically.
Secondly, the key point of your problem is not date format. The key point is that sql connector does not support for direct date filters in powerapps.
The solution:
I do not think you need to change data type for these two problems, using AddColumns function is enough.
AddColumns function will only reshape the sql table, it will not change the original table's data. You could add a table with the date format that you want for problem1, add a table by using this formula :YEAR([date]) * 10000 + MONTH([date]) * 100 + DAY([date]), filter based on this formula.
Formula:
1)display the data format that you want:
AddColumns(sqltablename,"newdate",Text(PERIODSTARTDATE,"yyyy/mm/dd"))
the new date field will be column that you want.
2)filter based on date column:
Filter(
AddColumns(sqltablename,
"startdate",
Year(PERIODSTARTDATE) * 10000 + Month(PERIODSTARTDATE) * 100 + Day(PERIODSTARTDATE),
"enddate",
Year(PERIODENDDATE) * 10000 + Month(PERIODENDDATE) * 100 + Day(PERIODENDDATE)
),
PAYCYCLEID=.....,
enddate>=Year(Today()) * 10000 + Month(Today()) * 100 + Day(Today()),
startdate<=Year(Today()) * 10000 + Month(Today()) * 100 + Day(Today())
)
Best regards,
For comparison of Dates in SQL with powerapps, it better ypu create another date column from the Documentation:
"Direct date filters do not work for SQL Server. However, you can create a calculated column that will work. For instance, ALTER TABLE myTable ADD DateAsInt AS (YEAR([date]) * 10000 + MONTH([date]) * 100 + DAY([date])) and then filter on the calculated number column"
https://docs.microsoft.com/en-us/connectors/sql/
Then use that calculated column in your formulas.
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
Hi @Anonymous ,
Firstly, I'm afraid it's not supported to change the default date format in powerapps. It is set by system automatically.
Secondly, the key point of your problem is not date format. The key point is that sql connector does not support for direct date filters in powerapps.
The solution:
I do not think you need to change data type for these two problems, using AddColumns function is enough.
AddColumns function will only reshape the sql table, it will not change the original table's data. You could add a table with the date format that you want for problem1, add a table by using this formula :YEAR([date]) * 10000 + MONTH([date]) * 100 + DAY([date]), filter based on this formula.
Formula:
1)display the data format that you want:
AddColumns(sqltablename,"newdate",Text(PERIODSTARTDATE,"yyyy/mm/dd"))
the new date field will be column that you want.
2)filter based on date column:
Filter(
AddColumns(sqltablename,
"startdate",
Year(PERIODSTARTDATE) * 10000 + Month(PERIODSTARTDATE) * 100 + Day(PERIODSTARTDATE),
"enddate",
Year(PERIODENDDATE) * 10000 + Month(PERIODENDDATE) * 100 + Day(PERIODENDDATE)
),
PAYCYCLEID=.....,
enddate>=Year(Today()) * 10000 + Month(Today()) * 100 + Day(Today()),
startdate<=Year(Today()) * 10000 + Month(Today()) * 100 + Day(Today())
)
Best regards,
User | Count |
---|---|
163 | |
89 | |
71 | |
64 | |
62 |
User | Count |
---|---|
210 | |
151 | |
97 | |
84 | |
66 |