How can I use the "Date and Time" Field Type to schedule release date of database rows?

I’m wanting to add information directly to my database that is connected to a repeater, but I want to hide the information from the public until scheduled times.

It would work like this:

  • Manually input your desired publish time in the “Date and Time” Field Type on the rows you are working on.
  • Input all the necessary content in the rows to populate the repeater.
  • Hit publish, but all the information would stay hidden, and only publish on the scheduled date and time.

Does anyone know the code to make this happen or have any advice?

Thanks!
Shan

You will need a bit of coding for this. I do not know against which date(s) you would like to publish. It could be against Today end everything later, it could be against “Today” until “Tomorrow”, you did not tell.
The basic thing is that you will have to build a simple query which uses “.ge” for first possibility or “.between” for second.
Then you throw the query’s result to the repeater (the repeater’s .data property) and Bob’s your uncle.

Thanks for that Giri,

I should have given a better example to show what I’m trying to achieve. We’re looking to do the same thing as YouTube does with uploading videos, and letting you schedule them at a later date. I’m just hoping to only do it inside the database area using the Date and Time column.

*See image of YouTube scheduler…

ps… I do have an Uncle Bob.

Understood. But … it is a wee bit more complex than you think. There is this thing about JS-dates/times which is called time zones. So if you schedule some video thru Content Manager (CM) at 07/05/2021/12:00 AM San Francisco time (UTC -7), the date written to the db will be 07/04/2021/17:00 UTC +0. But if you fly to New York and open up CM, the date will show as 07/04/2021/21:00 (UTC -4). Same will happen for your users when they view your web page. So you first have to decide if those time zones are a factor to be reckoned with. Then, you will either need a little bit of code, or a bigger piece of code, depending on your decision: if I set 12:00AM in SF, will it be all right if they see it 3 hours earlier in New York, or not? But in both cases, you cannot click your way out of if, I’m afraid.
P.S. My regards to your dear Uncle Bob.

LOL… Ya I would do it fixed to my timezone. It’s fine if it’s later in other time zones. I upload it manually now at 12am Pacific Time and have customers all over the world.