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 / Get Current Date and T...
Power Automate
Answered

Get Current Date and Time incorrect

(0) ShareShare
ReportReport
Posted on by

I use the Get current date and time action in a Power Automate Desktop flow and copy it to an Excel workbook to date stamp values captured from a few web pages. The action is returning a value that is not today's date. (The time is correct.) When run on the 5th of January 2023, it returned the value 1st of May 2023. This is not a simple date formatting issue. When the value was formatted as a General Number it was 45047.881087963. When the 1st of May 2023 is directly entered into Excel and formatted as a General Number the value is 45047, so the action is definitely returning "1st of May 2023". The action is somehow confusing the date of the month and the day!

 

I am in Australia where the date format has the day of the month before the month and how Windows 11 is configured. In the action there is the option of System time zone or a specific time zone. Get current date and time is returning the same value for either option.

I have the same question (0)
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Check this out:

     

    https://www.linkedin.com/pulse/power-automate-desktop-pad-best-practices-part-1-date-michael-annis

     

    You may be able to infer the proper date using these tools.

     

    Good luck!

  • Verified answer
    muibeta Profile Picture
    on at

    Thankyou Michael Annis for the tip.

    It appears I was incorrectly attributing issue to the Get current date and time action. What is actually happening is the value, CurrentDateTime, is being incorrectly transformed by Excel when writing it directly to a cell.

    The workaround I eventually found (using your suggestions) was to convert CurrentDateTime to text for the date, convert to text once more for the time, join the text, then write to a cell already formatted as text. See image of some test actions that works.

     

    muibeta_0-1672969514942.png

     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Yeah, I wish the dates had better functionality.  It seems to be going about it the long way most of the time.  I know there are other posts that discussed non-US Excel date issues, but I don't think any of them came to any conclusions.  @UK_Mike I think was getting close at one point, but I don't remember us getting a "pretty" solution.  You may want to check out some of his posts on this board if your work around ever fails.

    Glad you were able to get this one working.

  • UK_Mike Profile Picture
    on at

    Hey Mike, long time no see 😄

     

    Ive given up PAD, just too much grief, one day the dates work, next day they dont, amongst other things...

    Some of the most nerve-racking moments in my life was updating PAD 🙄

    I was evaluating PAD and UiPath at the same time, sticking with Uipath.

    In Uipath I can quite easily work with dates with a bit of string manipulation, ive yet to have a single error.

     

    This takes a UK date and converts to US, can add or subtract days / months etc, all in the same string.

    No dragging in multiple activities to achieve a desired output.

    DateTime.ParseExact(TodaysDate, "dd/MM/yyyy", CultureInfo.InvariantCulture).toString("MM/dd/yyyy")

     

    Happy New Year buddy 👍

  • werkbook Profile Picture
    36 on at

    @muibeta 

     

    As an alternative, you may wish to consider using the action Run PowerShell script instead:

    Untitled.png

     

    The PowerShell code to run would be:

     

    Get-Date -Format "dd/MM/yyyy hh:mm tt"

     

     

    Do note that you may need to trim the output first, i.e. use %DateTimeAsText.Trimmed% instead of %DateTimeAsText% when writing to Excel.

     

    PS: To read more about this topic, please visit PowerShell snippets (werkbook.co)

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard