Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

problem with date conversion

Locked
andreamori
Posts: 4
Joined: Sat Jun 11, 2011 11:45 am

problem with date conversion

Unread post by andreamori »

Sorry for my bad english (i'm italian) Hope to explain correctly the problem i need to create a report filtered by date and see in sampledebtors how do this; but when try to create the dataTable, the result don't work correctly; i get 2 date, $FromDate and $ToDate with object calendar formatted like d-m-Y (for example 29-07-2010 and 29-07-2011) the italian format (7 in table format); when get this with msql_date_nq function the result is 2010-01-02 (see with simple echo in php code)??? and in zzsys_variable table i see correct 29-07-2010 and 29-07-2011: but when in php code i write "WHERE workdate (is a field in a table contain date of work get with object in format d-m-Y but stored in table like Y-m-d) Between $FromDate And $ToDate etc..." don't work; if i remove on php code the filter "WHERE with date" the dataTable is correctly create; i need or to convert the result of field workdate to italian format (??? in browse table it's already so) or convert $FromDate ans $ToDate to format Y-m-d; i try with reformatField, try to get directly from Formvalue (without use msql_date_nq function) and convert with substring function and set date, but nothing... I'm very inexperienced; thank to google translator for help and if the question need another information i try to explain more.Can anyone help me?
Thank you so much
Andrea Mori
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: problem with date conversion

Unread post by admin »

Andrea,

29-07-2010 and 29-07-2011 needs to be 2010-07-29 and 2011-07-29
mysql filters just as if it was alphabetical.

(msql_date_nq() won't work because it is for a different format)


try this..

Code: Select all


$old = '31-08-2011';

nuDebug(reformatField($old, 7, $quotes = false));

Hope this helps.

Steven
andreamori
Posts: 4
Joined: Sat Jun 11, 2011 11:45 am

Re: problem with date conversion

Unread post by andreamori »

Yes now the code run correctly
Thank with heart and take this opportunity to congratulate you for your very interesting product

Andrea Mori
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: problem with date conversion

Unread post by admin »

Thanks Andrea.
Locked