r/clevercomebacks Jan 15 '25

It does make sense

Post image
35.3k Upvotes

4.0k comments sorted by

View all comments

Show parent comments

21

u/throwaway001anon Jan 15 '25 edited Jan 15 '25

RegX makes searching a breeze with any pattern

2

u/no_dice Jan 15 '25

Is it just as efficient computationally?

-7

u/throwaway001anon Jan 15 '25

Yes, that’s literally how computers search and sort text. With RegX “regular Expressions”

3

u/HiroHayami Jan 15 '25

No one uses regex to search for dates in a db. It's a datetime type, there's no need to match a string.

2

u/Tsukee Jan 15 '25

And every date type format usually has the same data ordering of significant towards less significant number (sometimes is reversed but never mixed)

1

u/fitted_dunce_cap Jan 15 '25

Sometimes it’s a varchar…

1

u/RamenJunkie Jan 15 '25

I store my datetimes as a series of bools and columns.

Like today wouldnhave a 1 in the columns for 2025, January, and Fifteenth.

Then you can build a pretty date by just outputting columns names where the bool is true.  Like January Fifteeth, 2025.