Convert Date and Time to DateTime (Timestamp)

There are four fields - Date In , Time In, Date Out, Time Out
Date fields are Type = Date , Time fields are Type = Time

I need to convert “Date In” and “Time in” to a DateTimeIn (Timestamp)
I need to convert “Date Out” and “Time Out” to a DateTimeOut (Timestamp)
Then,
I need to calculate the duration of (DateTimeOut - DateTimeIn) and result in number of minutes

Thanks.

First read this:

[Guide on How To Create a Community Post](https://community.appsheet.com/t/guide-on-how-to-create-a-community-post/35855) Tips & Tricks ?

Dear valuable members and users, For a long time I’m seeing a lot of multiple and concurrent posts, posts like novels seeming to aim the Pulitzer Price, exactly the same questions by the same user but paraphrased/re-phrased etc. Being a dedicated community member and an AppSheet developer who is reading around 2.5K posts per day, I urged myself to tip on some good advice and best practice BEFORE posting something in the community: #1 - APPSHEET DOCUMENTATION AppSheet has a very good help do…

And then take a look at these:

2 Likes

Please see the expressions below and let me know what they should be, and also the expression for “Total Minutes”. I have reviewed the appsheet help but I am doing something wrong.

DateTime In
DateTime(Date([Date In])&" " &Time([Time In]))

DateTime Out
DateTime(Date([Date Out])&" " &Time([Time Out]))

DateTime In:

(DATETIME([Date In]) + ([Time In] - "00:00:00"))

DateTime Out:

(DATETIME([Date Out]) + ([Time Out] - "00:00:00"))

The the duration between them:

([DateTime Out] - [DateTime In])

Or skip DateTime In and DateTime Out altogether with:

(
  (DATETIME([Date Out]) + ([Time Out] - "00:00:00"))
  - (DATETIME([Date In]) + ([Time In] - "00:00:00"))
)

Better still, do away with Date In, Time In, Date Out, and Time Out and simply record DateTime In and DateTime Out directly.

See also:

3 Likes

That works. Thank you.

1 Like