Air date picker values to database

Hi,

I am trying to pass the date pickers value to the database but I only want the date to be passed, not the time as well. I have seen similar queries on this forum mentioning using :extract but I’m not sure if this is correct or how to use this. Can someone please advise?

Date%20picker

Thanks in advance

John

I just get this and go round in a never ending loop of redness when I try and use :extract, so I’m sure I’m doing something wrong.

Dates are times. Regards of whether you care about the “time” (hours, minutes, seconds) component of a date object (and whether you ignore it, set those components to 0, etc.), a “date” object (which we should think of as a “date/time” object) is no longer a date if it has no time values.

We can, if we wish, convert objects of the date data type to other representations, such as a string (what Bubble calls a “text” data type), using operators such as :formatted as...

Comparing two date objects (for example, date_x and date_y) using their text representations is one of the easiest ways to tell if those two events happen on the same calendar day. For example, the following expression returns “yes” if date_x and date_y happen on the same date:

date_x:formatted as 11/17/2018 is date_y:formatted as 11/17/2018

Note: You really DON’T want to store a date as its text representation as it becomes hard to convert the text constantly back into a date. But we can always turn a date object into all sorts of text representations of that date/time.

For more on dates and various date-wise comparisons you can do, see my other posts and post replies where I mention “date/time”. Here’s a good one:

Hope this helps!

Keith

Exactly what I was looking for, thanks, it was the expression I needed but read through your other posts which were also very informative,

Thanks again

John

1 Like

@max79268 You don’t need to use find & replace on dates cause they already have their own formatting:
https://puu.sh/C3Pvf/7dc9d53114.png

FYI, I think what what @yusaney1 is referring to is that there is actually a syntax for putting all of the date components together. If you select “Custom” in Format Type, it will show you more-or-less every code that’s available. You’re free to rearrange 'em as you see fit at that point! (And note that there IS a way to get “November” instead of “Nov” right there.)

Simple example:

Format Type > Custom > YYYY-MM-DD // returns 2018-11-18

^^^^ this one is very useful as it’s one of the most common unambiguous date representations and is used by (and can be used with) a lot of external APIs, JavaScript, etc.

But Custom is also cool because you can insert other text (or even dynamic text) right there in the Custom field. Super flexible!

Ok yeah youre right i didnt see dynamic text option

1 Like

Took me a while to find that, too! But yeah all the tokens you’d need to customize a date/time display are there.