Convert Date to Datetime Flow Action

Created by Eric Smith


This Post was most recently updated on: 9/21/23
Current Version: 1.0.1


It’s fairly easy to extract the Date portion of a Datetime value in a Flow formula.

DATEVALUE({!datetimeValue})

If {!datetimeValue} = 7/22/2020 5:00 PM then the formula will return July 22, 2020.

It is a bit trickier to convert a Date value to a Datetime value using a formula. 

DATETIMEVALUE(TEXT({!dateValue}) + ” 00:00:00″)

If {!dateValue} = July 22, 2020 you would want the formula to return 7/22/2020 12:00 AM.  Instead the value returned will be converted to GMT so the result I get in Portland, Maine is 7/21/2020 8:00 PM.  For me, that’s 4 hours ahead of GMT.

I could find no easy way to do time-zone calculations in Flow so I created a Flow Action that would keep everything in my current time-zone.

With this action, my result for July 22, 2020 is 7/22/2020 12:00 AM.

If you want a timestamp of other than 12:00 AM, you can pass in the desired hour, minute and second values.


Attributes

AttributeTypeNotes
Date ValueDateThe Date to be used for the Datetime value
Hour Value (Default = 0)Integer(Optional) The Hour value to be used for the Datetime value (0-23)
Minute Value (Default = 0)Integer(Optional) The Minute value to be used for the Datetime value (0-59)
Second Value (Default = 0)Integer(Optional) The Second value to be used for the Datetime value (0-59)

Use Case

Read about an example that uses this action in a Flow to get the Time Zone offset for the running User.


Install

09/21/23 – v1.0.1 – Christopher Strecker
Moved Result initialization inside of the Request loop to fix bulkification

Unmanaged v1.0.1 (Production/Developer)
Unmanaged v1.0.1 (Sandbox)


Previous Versions

Created by – Eric Smith – July 2020

Unmanaged v1.0 (Production/Developer)
Unmanaged v1.0 (Sandbox)


Source Code

Source