how to change the date format from default to other format.

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

how to change the date format from default to other format.

#1

Postby xren » Wed Jan 16, 2013 7:52 pm

Hi Wai,

When I add a date field to a form, the default date format is dd/mm/yyyy. I would like to change it to yyyy/mm/dd. Where can I do this?

I changed the system.dateformat=yyyy/mm/dd in the ufssetup.properties file. But it seems that the server does not take the system date from from there. I saw the startup log in the console still show system date format is dd/mm/yyyy. (The server does take that ufssetup.properties file as configuration file.)

I restarted the server several times. It still the same.

Thanks,
Xiaoli
0 x

Steve
Moderator
Moderator
Posts: 421
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#2

Postby Steve » Thu Jan 17, 2013 10:22 am

Hi Xiaoli,

The date format for the field is picked up from the International settings.

You need to go to Tools-->System Preferences-->Internationalization.

Inside here you can select the language and the settings to use.

Otherwise, I am not sure there is another way to do this.
0 x

User avatar
Wai
Moderator
Moderator
Posts: 165
Joined: Wed Sep 12, 2007 9:04 am
Location: Sandy, UK
Contact:

#3

Postby Wai » Thu Jan 17, 2013 10:59 am

Yes, you have to change the language in Internationalization as mentioned by Steve.

I think for CRCD project, I set the formatting language to en_ZA
It uses short date of: yyyy/MM/dd
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

calender after date field disappeared after clear the field.

#4

Postby xren » Thu Jan 17, 2013 2:09 pm

Thank you both Steve and Wai.
I changed it to en_ZA. Then the format changes to yyyy/mm/dd.

Hi Wai, my other question is that when I click "clear" button to clear some fields value, the calender after the date field disappeared as well. Is there any settings wrong? (I copied the enquiry page and made some changes)
0 x

User avatar
Wai
Moderator
Moderator
Posts: 165
Joined: Wed Sep 12, 2007 9:04 am
Location: Sandy, UK
Contact:

#5

Postby Wai » Thu Jan 17, 2013 2:56 pm

I think this is because the the Calender is applied by JQuery? Is this your CRCD system? If so, the calenders are styled using JQuery UI.

This will be as a result of having Ajax turned on for the form and using JQuery's document.ready (on the page - html++) to apply the calender.

The problem here is that javascript you place into the page's document.ready will only be applied when the whole page is redisplayed. This works when Ajax on the form is turned off. Therefore, any changes you make to the form (immediate validation), causes the page to refresh.

At the time of writing CRCD (4.4.1), there was no way around this except disabling the Ajax on the form.

However, in 4.4.2, we introduced a new JQuery event

The ready event
Most events run in response to a user interacting with the page, e.g. clicking a button. The ready event is different – it is run when the page first loads, or when a control is shown from a previously hidden state and when Ebase refreshes the control (if Ajax has been enabled). This event can therefore be used to manipulate the control for display before it’s shown to the user. Typical examples might be to alter its style/class attributes or to configure the control as a JQuery UI widget.
For example, in the client script you may have had something like this which is added to the page:

Code: Select all

$(document).ready(function(){
	$(".datePicker").datepicker({
		showOn: "both",
		buttonText: '',
		buttonImage: "samples/images/themes/calendar.gif",
		buttonImageOnly: true,
		dateFormat: 'yy/mm/dd',
		showButtonPanel: false,
		changeMonth: true,
		changeYear: true
	});
});
With Ajax enabled, you will need to move this part below into the HTML Element Properties of the control (date field)

Code: Select all

$(".datePicker").datepicker({
		showOn: "both",
		//buttonText: 'Select Date',
		buttonText: '',
		buttonImage: "samples/images/themes/calendar.gif",
		buttonImageOnly: true,
		//dateFormat: 'dd/mm/yy',
		dateFormat: 'yy/mm/dd',
		showButtonPanel: false,
		changeMonth: true,
		changeYear: true
	});
This is found in HTML Element Properties - JQuery tab - Event drop down

Let me know how you get on.
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#6

Postby xren » Thu Jan 17, 2013 3:21 pm

Hi Wai,

Then I think I should remove the crcd_generic from the page.
When add the code to the date field control, what event should I chose from the event dropdown list?

Thanks,
Xiaoli
0 x

User avatar
Wai
Moderator
Moderator
Posts: 165
Joined: Wed Sep 12, 2007 9:04 am
Location: Sandy, UK
Contact:

#7

Postby Wai » Thu Jan 17, 2013 3:32 pm

Yes, remove the script from the page, add to the date control field. Select jquery event ready
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#8

Postby xren » Thu Jan 17, 2013 3:51 pm

I did the changes and it works fine now.

I may have other questions later.

Thank you very much.
Xiaoli
0 x

User avatar
Wai
Moderator
Moderator
Posts: 165
Joined: Wed Sep 12, 2007 9:04 am
Location: Sandy, UK
Contact:

#9

Postby Wai » Thu Jan 17, 2013 4:19 pm

That's great!

Feel free to post questions, please start a new thread for different topics and phrase them to the community if possible.
0 x

LKirby
Ebase User
Posts: 37
Joined: Wed Mar 13, 2013 11:33 am
Contact:

#10

Postby LKirby » Fri Apr 26, 2013 11:07 am

Hi, im having the same problem as xren was.

I've got a date field that needs to be in the format yyyy/mm/dd and im using a jquery datepicker to enter the date (that works fine) but then if i click any other button on the page then an error message pops up saying that the date format is dd/mm/yyyy. so i went in into internationalisation options and set english (south africa) as a default as it has the short date i wanted but i still get the same error message :(

any ideas?
0 x

User avatar
Wai
Moderator
Moderator
Posts: 165
Joined: Wed Sep 12, 2007 9:04 am
Location: Sandy, UK
Contact:

#11

Postby Wai » Fri Apr 26, 2013 11:27 am

Can you check your Internationalisation settings and disable the option (options tab)

2. Try to honour the users browser setting
0 x

LKirby
Ebase User
Posts: 37
Joined: Wed Mar 13, 2013 11:33 am
Contact:

#12

Postby LKirby » Fri Apr 26, 2013 12:06 pm

yeah works fine now, figured it out a few mins after asking for help.
thanks anyway :)
0 x


Who is online

Users browsing this forum: No registered users and 24 guests