Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: how to customize date format to MM/DD/YYYY
robee29
Newbie

Posts: 1
Registered: 2/16/2005
Member Is Offline
posted on 2/16/2005 at 09:21 AM Reply With Quote
how to customize date format to MM/DD/YYYY


I've searched this forum and the documentation page..so it said that the date format is customizable..if so, how can I do it???
View User's Profile View All Posts By User U2U Member
madaneag
Junior Member

Posts: 5
Registered: 2/16/2005
Member Is Offline
posted on 2/16/2005 at 03:55 PM Reply With Quote

i faced the same problem today
try this
in validator.js
change
re_dt = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/
'date' : function (s_date) {
// check format
if (!re_dt.test(s_date)){
return false;
}
// check allowed ranges
if (RegExp.$1 > 12 || RegExp.$2 > 31){
return false;
}
// check number of day in month
var dt_test = new Date(RegExp.$3, Number(RegExp.$1-1), RegExp.$2);
if (dt_test.getMonth() != Number(RegExp.$1-1))
return false;
return true;
}
View User's Profile View All Posts By User U2U Member
katAttack
Junior Member

Posts: 6
Registered: 6/3/2005
Member Is Offline
posted on 6/3/2005 at 05:45 AM Reply With Quote

Important think to note, there are two issues being dealt with in the example above.

1] The use of a Slash '/' instead of the default hyphen '-'
2] Change from DDMMYYYY to MMDDYYYY

So if you only want to change entry format to allow a slash instead of a hyphen they only change the line:

re_dt = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page Product Page
Product Demonstrations Product Demos
Registration Form Validation
Login Form Validation
Free Download Free Download
Product Documentation Documentation
Documenation Page
Change Log
Validators Comparison Table
Support Forum Support Forum
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004