Add the time to a date field
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This one should be pretty easy, but I can't quite find the right response already in a Community discussion. I have two fields. One is a DateTime format with zeroes for hours, minutes and seconds, e.g. 2021-04-25 00:00:00. The other field is a Time format with hours, minutes, and seconds, e.g., 19:11:10. I just want to add the hours, minutes and seconds in the Time field to the DateTime fields so I end up with 2021-04-25 19:11:10. Thanks for the assist!!!
Solved! Go to Solution.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
probably an easier way but try this:
datetimeparse(datetimeformat(tostring([mydatefield]),"%Y-%m-%d")+tostring([my time field]),"%Y-%m-%d%H:%M:%S")
included an extra "%" after the M so corrected above and here (slightly different field names below)
datetimeparse(datetimeformat(tostring([date]),"%Y-%m-%d")+ tostring([time]),"%Y-%m-%d%H:%M:%S")
and one more:
ToDateTime(tostring([date])+" "+tostring([time]))
I know that looks easier... but that's only if you remember to include the space in between the date and the time...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here is a formula on how you can do it.
datetimeparse(datetimeformat([Date],"%Y-%m-%d")+ [time],"%Y-%m-%d%H:%M:%S")
Workflow:
datetimeparse(
datetimeformat([Date],"%Y-%m-%d") // Taking only date from datetime format
+ [time] // Concating time value
,"%Y-%m-%d%H:%M:%S") // Converting it to datetime
Hope this helps 🙂
