Coder
Coder

Reputation: 1899

How to insert date and time in Google spreadsheet

I would like to insert a custom date and time in the Google Spreadsheet single cell with custom formatting.

I am able to pick a custom format thanks to the post: https://www.ablebits.com/office-addins-blog/2017/10/12/date-time-google-sheets/

But I am not able to insert a specific value that captures both date and time. The formula I am trying is something like: =Date(2022, 2, 20, 04:08:53 PM) and the desired output is something like: Sun, Feb 20, 2022, 04:08:53 PM but naturally it fails since the =DATE() API only takes in 3 parameters.

Is there some other API that helps capture both date and time?

Thanks!

Upvotes: 0

Views: 43

Answers (1)

basic
basic

Reputation: 11968

Use TIME function:

=DATE(2022,2,20)+TIME(16,8,53)

or TIMEVALUE, if you enter time as string:

=DATE(2022,2,20)+TIMEVALUE("4:08:53 PM")

enter image description here

Upvotes: 1

Related Questions