Combine days and hours into final date


#1

Hi,
I’ve searched the forum but didn’t find what I was looking for… but maybe I missed it. Sorry if that’s the case.
So I want to create the final date for an event.
I have a first set of functions that determine on which day it should happen and a second that determines at what time.
so in the end I have a field with a date (no time) and a field with hours/minutes.
I would like to create a new field combining both.
first I tried concatenate but it didn’t turn out well. then I tried using DateADD but the minutes were not recognized and converted as if they were decimals…
any idea on how to achieve that ?
thanks


#2

Could we have a little bit more info on your fields ? or a screenshot ? :wink:
How are your fields formatted ?

Depending on how those fields have been created and how they’re now structured, there might be different ways to get to the results you want :wink:


#3

I agree. I think the main point is that there is not Time field type, so maybe you are using Duration or something.


#4

Hi @Ptt_Pch & @Elias_Gomez_Sainz
here is a screenshot.
“début” is the date
“ordre” & “heure début 1” are variables
“heure C1” is the time calculated based on "ordre and “heure début c1”
“cour 1_final” is where I would like to combine “début” and “heure C1”.
hope that makes it a little clearer.
thanks !


#5

Lol, yes and no :yum:

I couldn’t reproduce your screenshot so I couldn’t really try and test before replying :wink:

But did you simply try this for your {Cour 1_final} field :

DATETIME_FORMAT({début},'M/D/YYYY')&'  '&{heure C1}

It’s kind of a simple concatenation of those 2 {début} and {heure C1}, as {heure C1} seems to return a “text”

Is that what you wanted ?


#6

Hi @Ptt_Pch.
I tried your solution and indeed it provides the correct result as a text string ! Thanks.
But Airtable doesn’t recognize it as a valid date so I can’t display it in the calendar… and I need to be able to do that.
I found a workaround (not very user friendly) which is to express the time in minutes. That way I can perform a DATEADD({début},{heure C1},'minute')
in this scenario an event starting at 08:30 must be entered as starting at +510 minutes by the user… not very intuitive so if anyone has a better idea, I would be thankful !


#7

You can use DATETIME_PARSE() that is the inverse of DATETIME_FORMAT(), it converts the resulting string into a Date.


#8

IT works !!!
Thanks a lot !
:star_struck::pray::clap: