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 Apps / Patch date as a number...
Power Apps
Suggested Answer

Patch date as a number to Excel number column

(0) ShareShare
ReportReport
Posted on by 291
Hi,
 
I want to patch the date and time as a number to Excel having been driven to despair by all the problems I have have had with dates.
 
I am using the following formula within the app for the patch:
 
DecimalDay: DateDiff(
            DateTimeValue("1/1/1900") - 2,
            Now(),
            TimeUnit.Days
        ) + (DateDiff(
            Now(),
            Now(),
            TimeUnit.Minutes
        ) / 1440)
The data type is a number:
 
 
The Excel column format is also number. However, when I do the patch, the number appears as 1970-01-01T00:00:45.618Z in the Excel column. The number I need is hidden in there but why isn't it just giving me 45618? How can I just get that number?
 
Any help would be much appreciated, thanks.
 
Izzy.
Categories:
I have the same question (0)
  • Suggested answer
    Rayon Robert Profile Picture
    20 on at
    Hi @Izzy,
     
    The issue you're facing likely arises because PowerApps handles dates and times differently than Excel, and the Patch function may not be correctly interpreting your calculated value due to mismatched data types. Here is my recommendation:
     
    1. Use Value() or Text() function
    Modify your formula slightly to explicitly convert the calculated result into a number using the Value() function.
    Using Value()
    DecimalDay: Value(
        DateDiff(
            DateTimeValue("1/1/1900") - 2,
            Now(),
            TimeUnit.Days
        ) + (DateDiff(
            Now(),
            Now(),
            TimeUnit.Minutes
        ) / 1440)
    )
     
    Using Text()
    DecimalDay: Text(
    DateDiff(
    DateTimeValue("1/1/1900") - 2,
    Now(),
    TimeUnit.Days
    ) + (DateDiff(
    Now(),
    Now(),
    TimeUnit.Minutes
    ) / 1440),
    "[$-en-US]0.00"
    )
     
    2. Confirm that the Excel column is formatted as a number and not as a date/time type. Even though Excel can interpret numeric values as dates, mismatched formatting might lead to the output you are seeing.
    Let me know if this resolves your problem :)
  • ronaldwalcott Profile Picture
    3,847 Super User 2025 Season 2 on at
    Did you have the column previously defined as a date in the Excel spreadsheet?
    If so, after changing it did you refresh the data source in the app as it is not treating the column as a number.
  • IzzyWizz Profile Picture
    291 on at
     
    It did appear to be a formatting issue somewhere. I did have the Excel column formatted as a number but I think originally, I did have it as a date. I refreshed the link in PowerApps and checked the formatting again but it still didn't work. However, when I created a new Excel column with a number format from the start, it worked first time.
     
    Thank you for your help. 
     
    Izzy.

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard