alunr
Newbie
Posts: 1
Registered: 2/27/2003
Member Is Offline
|
| posted on 2/27/2003 at 07:38 PM |
|
|
Changing dd-mm-yyyy to dd/mm/yyyy
I need to change the accepted date format and the output format to be able to store the data in my database.
How can I do this or do I need the PRO version?
|
|
|
nik
Posts:
Registered: 1/1/1970
Member Is Offline
|
| posted on 2/28/2003 at 01:42 PM |
|
|
You should just revise file calendar1.js. To change input format line 101 is changed from:
var arr_date = str_date.split('-');
to:
var arr_date = str_date.split('/');
To alter output format lines 69 and 70 ( cal_gen_date1 function body) are changed from:
(dt_datetime.getDate() < 10 ? '0' : '') + dt_datetime.getDate() + "-"
+ (dt_datetime.getMonth() < 9 ? '0' : '') + (dt_datetime.getMonth() + 1) + "-"
to:
(dt_datetime.getDate() < 10 ? '0' : '') + dt_datetime.getDate() + "/"
+ (dt_datetime.getMonth() < 9 ? '0' : '') + (dt_datetime.getMonth() + 1) + "/"
|
|
|
deepak
Junior Member
Posts: 2
Registered: 2/21/2003
Location: India
Member Is Offline
|
| posted on 3/6/2003 at 06:31 AM |
|
|
Date Formats
Hi there,
Different Databases have different formats. Like Oracle prefers:
dd-Mon-YYYY
MySQL prefers YYYY-MM-DD
Perhaps we can set one object to detect the requirement and then where to append the necessary formatting and return of values in
calender1/calender2.js files?
|
|
|
tigra
Administrator
Posts: 1960
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 3/8/2003 at 11:54 AM |
|
|
This approach is already implemented in PRO version of the product. It has separate files for date conversion routines. Numerous date format filters
come with the package. You just need to link the one you need. This can be done dynamically.
Note: Yes, you can switch different date formats on the client-side, but this isn't very good idea: before passing any data to database you
should validate it on the server side for security and robustness reasons. Having different date formats requires different validators on the server
side. Better idea is to stick to some format dates are passed to server side and convert them to format database accepts after the validation.
|
|
|