Saving and retrieving dates

For a booking situation, user selects a date and time for the booking. When I look at the database, the date is stored like this - with time. I have a separate field for time slot.

The problem I see is when I retrieve this date in a “Do a search for” situation", I don’t think “date = booking date” does not work. So, I cannot but use a walk-around way to get this done.

Is there any way I can save date value as only “date” like 17/08/2022?

Thanks.

Yes. You can save the date as text.

1 Like

The reason you aren’t seeing anything, is because Date = Booking Date is looking at a specific date AND time, so it would be very specific if it ever showed anything. What you’re going to want to do is
image

You have your Date, could be the same Date for both searches, but you want to look for the specific Date >= the Date you are searching, and then Date <= Date you are searching + 1 Day. This will give you a 24 hour range in 1 specific date. But remember, if your starting date is 07/01/2022 08:00 AM, it’s going to show from 07/01/2022 08:00AM - 07/02/2022 08:AM. so I usually change the starting hours to 0 and ending hours to 0, so that it starts at midnight and ends at midnight.

I hope this makes sense!

or, you can do as what @rpetribu says above, save it as a text, and your search will have to convert date to text to match

1 Like

Thank you @rpetribu and @bcart0v. @bcart0v’s way is how I manage dates so far, but I was wondering if I am missing a better/simpler way. Saving the date data as text sounds also good to me, thanks @rpetribu.

I appreciate your knowledge-sharing.

I save dates both ways, the long-date format and text format, just so in the future if I need to do data searches differently the option is there. it won’t hurt anything to have the option!

2 Likes

No problem. Glad I helped…

I have some booking apps and found that working with dates is always better with 3 fields:

  • Date as Date
  • Date as text mm/dd/yyyy
  • Date as text HH:MM

Depending of what you want, you can use one of these fields in your searches. It gives you more versatility and agility with searches…

2 Likes

:joy: Same here

@rpetribu @bcart0v
I just went back to my database and just added text field. Haha~~~
Great pleasure to learn more.

Thanks you, gents. :heart_eyes:

2 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.