Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

How to subtract dates to calculate nights

Questions related to using nuBuilder Forte.
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: How to subtract dates to calculate nights

Unread post by kev1n »

1000 * 60 * 60 *24 * 365.25 / 12

is the same as

2000 [ which is 24/12*1000 ] * 3600 * 365.25
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: How to subtract dates to calculate nights

Unread post by kev1n »

joecocs wrote:
===USER==========

globeadmin

===PDO MESSAGE===

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE 1' at line 2

===SQL===========

SELECT
WHERE 1

===BACK TRACE====

/volume1/web/ISEA/nuform.php - line 350 (nuRunQuery)

/volume1/web/ISEA/nuform.php - line 331 (nuBrowseTotals)

/volume1/web/ISEA/nuapi.php - line 42 (nuGetFormObject)
Can it have a consequence?
Update nuBuilder (or just replace nuform.php https://github.com/steven-copley/nubuil ... nuform.php) and the error will be gone.
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: How to subtract dates to calculate nights

Unread post by joecocs »

Thank you for the answers,
I continue to optimize my management interface.

A question concerning the date format in the 'browse forms', I cannot change the format.

do you have an idea
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: How to subtract dates to calculate nights

Unread post by kev1n »

What date format are you trying to set?
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: How to subtract dates to calculate nights

Unread post by joecocs »

dd/mm/yyyy
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: How to subtract dates to calculate nights

Unread post by kev1n »

It's better to ask just one question per topic. Now your question is not related to the original topic "How to subtract dates to calculate nights".
It allows other people with a similar problem to find the answer more easily.
faroinsua
Posts: 15
Joined: Sat Feb 01, 2020 4:04 pm

Re: How to subtract dates to calculate nights

Unread post by faroinsua »

joecocs wrote:YESSSSSSSSSS !

Thank's

How do we make this symbol (")

on the other hand the result is not saved in the fields ??? :?:

Great, thank your very much It works, it calculates the nights.....so nice.
I still have the same problem than joecocs, that the calculated value is not saved, it just saves a zero. I also tried to download and substitute the nuform.php file, it didn´t help.
Should the calculated nights-field be a nunumber? Or only number, and which format should the column in mysql have, INT (3) ?
Thank you. Best regards.
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: How to subtract dates to calculate nights

Unread post by kev1n »

The important thing is to call change() after setting a value.

Code: Select all

$('#your_field').val("xxx").change();
INT (3) should work and also nuNumber / Number.
faroinsua
Posts: 15
Joined: Sat Feb 01, 2020 4:04 pm

Re: How to subtract dates to calculate nights

Unread post by faroinsua »

Sorry, where do I insert that $('#your_field').val("xxx").change(); code?
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: How to subtract dates to calculate nights

Unread post by kev1n »

faroinsua wrote:Sorry, where do I insert that $('#your_field').val("xxx").change(); code?
Just read through this topic, starting here:
https://forums.nubuilder.cloud/viewtopic. ... 251#p20421
Post Reply