Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date functions which take into account leap years and seconds #62

Closed
Mythli opened this issue Jan 21, 2023 · 2 comments
Closed

Date functions which take into account leap years and seconds #62

Mythli opened this issue Jan 21, 2023 · 2 comments

Comments

@Mythli
Copy link

Mythli commented Jan 21, 2023

Dear sqlean team,

working with sqlite dates is a real pain because date modifiers don't take into account leap years making the output of them unreliable.

The users of my app would consider this a serious bug.

Example:

select datetime('1993-06-30 23:59', '+20 months') as dt;

should return 1995-02-28 23:59 but it returns 1995-03-02 23:59:00 because sqlite does not take into account leap years.

  1. Do you know of any plugin with proper date and time functions which work bug free?
  2. If not, do you know any hack which can solve this?

I believe a plugin for better date and time handling including convenience functions for formatting, parsing and modifying dates would very much help the community.

Best regards

@nalgeon
Copy link
Owner

nalgeon commented Jan 25, 2023

The problem isn't in leap years, I believe. For example, this query in SQLite:

select datetime('1993-08-31', '+1 month') as dt;

returns 1993-10-01.

While the same query in PostgreSQL (or MySQL):

select '1993-08-31'::date + interval '1 month';

returns 1993-09-30.

I don't know how to make SQLite behave like PostgreSQL in this case, unfortunately.

@nalgeon
Copy link
Owner

nalgeon commented Jan 10, 2024

Sorry, I have no plans to add new features at this time.

@nalgeon nalgeon closed this as completed Jan 10, 2024
@nalgeon nalgeon closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants