Using datetimeadd() functions on HH:mm:ss format
- 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
I am having trouble using the DateTimeAdd() function to add minutes to a date field when the data is in HH:mm:ss format, using the function only produces null values. When I use a full datetime format (YYYY-MM-DD HH:mm:ss) I can add minutes no problem. I have included a workflow where both formats are attempted to use the DateTimeAdd() function. Please let me know if you have any suggestions.
Solved! Go to Solution.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Rwebber1991, that's because the DateTimeAdd function can only take date or datetime as input. To work around this, you can mock up a date first and then extract the added time only.
For example:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yeah, if you look at your HH:MI:SS field type in the select tool you'll see that its vstring, not datetime. You can only use datetimeadd on datetime data. When you use the dateparse tool you end up converting it from string to time. You still can't use datetimeadd on time, only on datetime.
I would append a date onto your time, force it into datetime, and then use datetimeadd to add your seconds, then convert back to time. Something like the attached.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Okay yeah this is what I was thinking. I wasn't sure if there was a way to add to just the time variable. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This is helpful thank you.
