|
 |
asp_web_howto thread: Date checking at client side
Message #1 by manie_khaneja@h... on Wed, 17 Jan 2001 08:44:26 -0000
|
|
My application require that the date difference b/w two dates should be
calculated at client side ... I am telling the user to enter the date in
MM/DD/YY format, I am using the cdate function to convert the value
entered in the HTML textbox .. but the problem is that whenever cdate fn.
converts the value into date it uses the client m/c locale setting and if
it is dd/mm/yy it converts the value into that format ie to say that if i
have two textboxes with values 11/11/2001 and 11/12/20001 on one client
m/c with locale setting as mm/dd/yy my script(VB datediff fn.) will give 1
day and on another client m/c with dd/mm/yy setting it will give a date
difference of one month ... how can i achieve that date difference at
client side be independent of client locale setting ( preferably i want a
code in VB)
Message #2 by Gregory_Griffiths@c... on Wed, 17 Jan 2001 12:00:33 +0000
|
|
Why are you using VB ? only IE uses this by default, most browsers use
Javascript, I suggest that you look to implement it in Javascript if
you are going to do it on the client side.
> -----Original Message-----
> From: manie_khaneja@h... [mailto:manie_khaneja@h...]
> Sent: 17 January 2001 20:08
> To: asp_web_howto@p...
> Cc: manie_khaneja@h...
> Subject: [asp_web_howto] Date checking at client side
>
>
> My application require that the date difference b/w two dates
> should be
> calculated at client side ... I am telling the user to enter
> the date in
> MM/DD/YY format, I am using the cdate function to convert the value
> entered in the HTML textbox .. but the problem is that
> whenever cdate fn.
> converts the value into date it uses the client m/c locale
> setting and if
> it is dd/mm/yy it converts the value into that format ie to
> say that if i
> have two textboxes with values 11/11/2001 and 11/12/20001 on
> one client
> m/c with locale setting as mm/dd/yy my script(VB datediff
> fn.) will give 1
> day and on another client m/c with dd/mm/yy setting it will
> give a date
> difference of one month ... how can i achieve that date difference at
> client side be independent of client locale setting (
> preferably i want a
> code in VB)
>
Message #3 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Wed, 17 Jan 2001 12:06:19 -0000
|
|
provide seperate boxes for day month and year, or even drop downs. Then
there will be no room for abiguity.
if you're doing it at the client side its better to use javascript, unless
you know everyone is using IE
example:
var d = new date();
d.setDate(document.all.dayfield1);
d.setMonth(document.all.monthfield1 - 1);
//need to subtract 1 because javascript uses 0-11 for months
d.setFullYear(document.all.yearfield1);
now d will contain the right date whatever the locale settings.
if you don't want to provide seperate boxes, then you can get them to enter
dd/mm/yyyy and use the split function to separate the dateparts.
-----Original Message-----
From: manie_khaneja@h... [mailto:manie_khaneja@h...]
Sent: Wednesday, January 17, 2001 8:08 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Date checking at client side
My application require that the date difference b/w two dates should be
calculated at client side ... I am telling the user to enter the date in
MM/DD/YY format, I am using the cdate function to convert the value
entered in the HTML textbox .. but the problem is that whenever cdate fn.
converts the value into date it uses the client m/c locale setting and if
it is dd/mm/yy it converts the value into that format ie to say that if i
have two textboxes with values 11/11/2001 and 11/12/20001 on one client
m/c with locale setting as mm/dd/yy my script(VB datediff fn.) will give 1
day and on another client m/c with dd/mm/yy setting it will give a date
difference of one month ... how can i achieve that date difference at
client side be independent of client locale setting ( preferably i want a
code in VB)
____________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Message #4 by "Wally Burfine" <oopconsultant@h...> on Wed, 17 Jan 2001 14:33:14 -0000
|
|
dim vDate(), dteDate
dim strS
strS = frm.MyForm.ID_DateField.value
vDate = Split(strS, "/")
' for mm/dd/yy
dteDate = DateSerial(vDate(2),vDate(0),vDate(1))
...
>From: "Alex Shiell, ITS, EC, SE" <alex.shiell@s...>
>Reply-To: "ASP Web HowTo" <asp_web_howto@p...>
>To: "ASP Web HowTo" <asp_web_howto@p...>
>Subject: [asp_web_howto] RE: Date checking at client side
>Date: Wed, 17 Jan 2001 12:06:19 -0000
>
>provide seperate boxes for day month and year, or even drop downs. Then
>there will be no room for abiguity.
>
>if you're doing it at the client side its better to use javascript, unless
>you know everyone is using IE
>
>example:
>
>var d = new date();
>
>d.setDate(document.all.dayfield1);
>
>d.setMonth(document.all.monthfield1 - 1);
>//need to subtract 1 because javascript uses 0-11 for months
>
>d.setFullYear(document.all.yearfield1);
>
>now d will contain the right date whatever the locale settings.
>
>if you don't want to provide seperate boxes, then you can get them to enter
>dd/mm/yyyy and use the split function to separate the dateparts.
>
>
>-----Original Message-----
>From: manie_khaneja@h... [mailto:manie_khaneja@h...]
>Sent: Wednesday, January 17, 2001 8:08 PM
>To: ASP Web HowTo
>Subject: [asp_web_howto] Date checking at client side
>
>
>My application require that the date difference b/w two dates should be
>calculated at client side ... I am telling the user to enter the date in
>MM/DD/YY format, I am using the cdate function to convert the value
>entered in the HTML textbox .. but the problem is that whenever cdate fn.
>converts the value into date it uses the client m/c locale setting and if
>it is dd/mm/yy it converts the value into that format ie to say that if i
>have two textboxes with values 11/11/2001 and 11/12/20001 on one client
>m/c with locale setting as mm/dd/yy my script(VB datediff fn.) will give 1
>day and on another client m/c with dd/mm/yy setting it will give a date
>difference of one month ... how can i achieve that date difference at
>client side be independent of client locale setting ( preferably i want a
>code in VB)
>____________________________________________________________
>Scottish Enterprise Network
>http://www.scottish-enterprise.com
>
|
|
 |