geetha
Newbie
Posts: 1
Registered: 6/8/2006
Location: hyderabad
Member Is Offline
|
| posted on 6/8/2006 at 02:54 AM |
|
|
calender in yyyy/mm/dd format
from this attachment i am getting date in mm/dd/yyyy format but i want date in yyyy/mm/dd format.
pl reply me
regards
asha
Attachment: date12.html (1.33kb)
This file has been downloaded 364 times
|
|
|
Compiler
Newbie
Posts: 1
Registered: 8/3/2006
Location: Russia
Member Is Offline
|
| posted on 8/3/2006 at 02:49 AM |
|
|
| Quote: | Оригинальное сообщение от geetha
from this attachment i am getting date in mm/dd/yyyy format but i want date in yyyy/mm/dd format.
pl reply me
regards
asha |
Hi all you need is to modify calendar1.js in two places:
this for format yyyy-mm-dd
// date generating function
function cal_gen_date1 (dt_datetime) {
return (
(dt_datetime.getDate() < 10 ? '0' : '') + dt_datetime.getDate() + "-"
+ (dt_datetime.getMonth() < 9 ? '0' : '') + (dt_datetime.getMonth() + 1) + "-"
+ dt_datetime.getFullYear()
);
}
and second to parse already input date:
// date parsing function
function cal_prs_date1 (str_date) {
var arr_date = str_date.split('-');
if (arr_date.length != 3) return cal_error ("Invalid date format: '" + str_date + "'.\nFormat accepted is dd-mm-yyyy.");
if (!arr_date[0]) return cal_error ("Invalid date format: '" + str_date + "'.\nNo day of month value can be found.");
if (!RE_NUM.exec(arr_date[0])) return cal_error ("Invalid day of month value: '" + arr_date[0] + "'.\nAllowed values are unsigned
integers.");
if (!arr_date[1]) return cal_error ("Invalid date format: '" + str_date + "'.\nNo month value can be found.");
if (!RE_NUM.exec(arr_date[1])) return cal_error ("Invalid month value: '" + arr_date[1] + "'.\nAllowed values are unsigned integers.");
if (!arr_date[2]) return cal_error ("Invalid date format: '" + str_date + "'.\nNo year value can be found.");
if (!RE_NUM.exec(arr_date[2])) return cal_error ("Invalid year value: '" + arr_date[2] + "'.\nAllowed values are unsigned integers.");
var dt_date = new Date();
dt_date.setDate(1);
if (arr_date[1] < 1 || arr_date[1] > 12) return cal_error ("Invalid month value: '" + arr_date[1] + "'.\nAllowed range is 01-12.");
dt_date.setMonth(arr_date[1]-1);
if (arr_date[2] < 100) arr_date[2] = Number(arr_date[2]) + (arr_date[2] < NUM_CENTYEAR ? 2000 : 1900);
dt_date.setFullYear(arr_date[2]);
var dt_numdays = new Date(arr_date[2], arr_date[1], 0);
dt_date.setDate(arr_date[0]);
if (dt_date.getMonth() != (arr_date[1]-1)) return cal_error ("Invalid day of month value: '" + arr_date[0] + "'.\nAllowed range is
01-"+dt_numdays.getDate()+".");
return (dt_date)
}
|
|
|
tigra
Administrator
Posts: 1960
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 3/9/2007 at 10:27 PM |
|
|
Ok, we have added the format to the standard distribution. Please re-download.
|
|
|