I have just looked into the code and database to find out how I can change the date formatting (in particular) to a format that is leagal i Norway (such as "dd.mm.yyyy"). But i found that rather hard.
Managed to edit the code to change the formatting a date from the database into an object. But then, the date became unparsable when read back from the form to be stored in the database. So this problem has two sides...
Does nuBuilder have an intended way of doing this, or is it a feature that I have to wait for.
Then consider this a feature request.
The best way is, if I could specify the date format in a 'free' form, such as "dd.mm.yyyy" or "d/m-yy".
Agnar
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Custom number and date formatting
-
- Posts: 503
- Joined: Thu May 24, 2012 2:08 am
- Location: Milan, Italy
- Contact:
Re: Custom number and date formatting
Agnar,
to show date on browse form you can use SQL in Browse tab > Display field:
Here the documentation: https://dev.mysql.com/doc/refman/5.1/en ... ate-format
Changing format on Edit form isn't so simple.
I never tryed this, but a workaround could be build a little JavaScript function:
to call for each date field in On Blur field:
o, better, in Custom Code > Javascript > nuLoadThis() function
Hope this helps,
Max
to show date on browse form you can use SQL in Browse tab > Display field:
Code: Select all
DATE_FORMAT(your_date_field, '%d.%m.%Y')
Changing format on Edit form isn't so simple.
I never tryed this, but a workaround could be build a little JavaScript function:
Code: Select all
function getMyDate(oldD) {
var d = oldD.split("-");
// Build the format you like
var newD = d[0]+"."+d[1]+"/"+d[2]; // 27.01/2013
return newD;
}
Code: Select all
$("#your_date").val(getMyDate($("#your_date").val()));
Hope this helps,
Max
-
- Posts: 37
- Joined: Sun Apr 21, 2013 10:58 pm
Re: Custom number and date formatting
Thank's. I'll look in to it.
At least, I can make the the date formats of my reports correct this way, that's where I need them to be correct.
At least, I can make the the date formats of my reports correct this way, that's where I need them to be correct.
-
- Posts: 503
- Joined: Thu May 24, 2012 2:08 am
- Location: Milan, Italy
- Contact:
Re: Custom number and date formatting
Agnar, to use custom format on date fields in your reports you can:
1) in Add Activity > Report tab > PHP Data Code build your SQL to get date fields from MySQL using the format you like:
2) for all date objects in Report Builder > Object property > Format leave the field empty.
Max
1) in Add Activity > Report tab > PHP Data Code build your SQL to get date fields from MySQL using the format you like:
Code: Select all
CREATE TABLE #dataTable# SELECT
DATE_FORMAT(my_date_field, '%d.%m/%Y'), ...
2) for all date objects in Report Builder > Object property > Format leave the field empty.
Max