How to get number of Months since unix epoch

Options

Hey guys,

Is there a filter option to get the number of months from the unix epoch?

I'm doing a query all records and looking to see if the user already has a record in the table for the current month, so looking to get the number of months since the unix epoch to compare. How would I go about this?

Thanks

Answers

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    To get such a value, I would would get the year, subtract 1969, multiply the difference by 12, and then add to that product the month of the year, followed by subtracting 1 from that sum.

    But really, I would just store a value in the table of "month" as a "date" data type in the format YYYY-MM-DD where the "DD" is always "01". That would make an exact match much easier and not require weird math like my first paragraph! (As much as I do love my weird math!)