1. Jonathan Ashwell
  2. Valentina Database ADK
  3. Saturday, April 13 2024, 12:24 PM
  4.  Subscribe via email
I'm using this expression to calculate date intervals (e.g. to find all records entered within the last 2 weeks):

dateAdded > datediff( now(), '01/01/1904 00:00:00', 'second' ) - (14 * 24 * 60 * 60)

However, it works in some locales but not others. For example, in some languages you need to enter the year as 01.01.1904 or 01-01-1904.

How can I avoid this problem with how the date part separators differ between locales?
Comment
There are no comments made yet.
Ivan Smahin Accepted Answer
Hi Jonathan

DateTimeFormat and DateSeparator are set following the current locale, but you may change it:

https://valentina-db.com/docs/dokuwiki/v13/doku.php?id=valentina:vcomponents:vsql:reference:expr:funcs_datetime&;s[]=set&s[]=property&s[]=datetimeformat&s[]=database&s[]=kymd


SET PROPERTY DateTimeFormat OF DATABASE TO 'kMDY';
SET PROPERTY DateSeparator OF DATABASE TO '/';
SELECT datediff( now(), '01/01/1904 00:00:00', 'second' ) - (14 * 24 * 60 * 60)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 1
Jonathan Ashwell Accepted Answer
Thank you, Ivan, that does the trick.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 2
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories