Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Dates and Regional Settings


Message #1 by Nikos <pappas@c...> on Thu, 09 Jan 2003 01:53:08 +0200
Hi

I need a good advice about what do you suggest as best.
In an Intranet some clients use different regional settings.
How can I ensure that a date is properly added to a database in the
database (server) .
I have used format(my_date," different formats  ") but still I am having 
problems sometimes

Any suggestions will be very much appreciated or links to where I can read 
about it

Best regards

Nikos


Message #2 by Jean Halstad <J_Halstad@S...> on Thu, 9 Jan 2003 09:24:47 -0000
Totally control the way the user enters the date. Have three list/menu boxes
on your forms for day, month, year. Force the user to select the appropriate
item from the lists. That way you know exactly what you are getting and
there is less opportunity for user error.

Jean

Hi

I need a good advice about what do you suggest as best.
In an Intranet some clients use different regional settings.
How can I ensure that a date is properly added to a database in the
database (server) .
I have used format(my_date," different formats  ") but still I am having 
problems sometimes

Any suggestions will be very much appreciated or links to where I can read 
about it

Best regards

Nikos




		  
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed
If you have received this e-mail in error please notify
seafish@s...

If the content is not about the business of the Sea Fish Industry Authority
or the sea fish industry then the message is neither from nor sanctioned
by the Sea Fish Industry Authority.  

Working with the Seafood industry to satisfy consumers, 
raise standards, improve efficiency and secure a sustainable future.  
Web Site:  www.seafish.co.uk
Message #3 by Nikos <pappas@c...> on Thu, 09 Jan 2003 14:26:29 +0200
Hi Jean
Thank you for your answer

Looks like this is the way

Please take a moment to answer this
The code is in a VB DLL. the dadabase SQLServer

Is it possible to do something like this?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dim MyDateToAdd as date

day(MyDateToAdd ) =3D MyMonthValue
month(MyDateToAdd ) =3D MyDayValue
year(MyDateToAdd ) =3D MyYearValue

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I know this does not work but is there a way to do that?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I tried
format(MyDateToAdd,"mm/dd/yyyy")
MyDateToAdd=3D" & MyMonthValue & "/" & MyDayValue & "/" MyYearValue & "

No Luck

Anyway
Thanks again

Best regards
Nikos



At 11:24 =F0=EC 9/1/2003, you wrote:
>Totally control the way the user enters the date. Have three list/menu
 boxes
>on your forms for day, month, year. Force the user to select the
 appropriate
>item from the lists. That way you know exactly what you are getting and
>there is less opportunity for user error.
>
>Jean
>
>Hi
>
>I need a good advice about what do you suggest as best.
>In an Intranet some clients use different regional settings.
>How can I ensure that a date is properly added to a database in the
>database (server) .
>I have used format(my_date," different formats  ") but still I am having
>problems sometimes
>
>Any suggestions will be very much appreciated or links to where I can read
>about it
>
>Best regards
>
>Nikos
>
>
>
>
>
>This e-mail and any files transmitted with it are confidential and intended
>solely for the use of the individual or entity to whom they are addressed
>If you have received this e-mail in error please notify
>seafish@s...
>
>If the content is not about the business of the Sea Fish Industry Authority
>or the sea fish industry then the message is neither from nor sanctioned
>by the Sea Fish Industry Authority.
>
>Working with the Seafood industry to satisfy consumers,
>raise standards, improve efficiency and secure a sustainable future.
>Web Site:  www.seafish.co.uk
>


Message #4 by Jean Halstad <J_Halstad@S...> on Thu, 9 Jan 2003 14:59:16 -0000
You seem to have swopped the day and month values. You have got day =3D 
My
MonthValue. Is this the cause of the problem?

The format code should go after you have written the date, not before. 
Not
certain you need it anyway. If I'm wrong can someone tell me.

You've missed an ampersand in this line. You don't put quotes round
variables in VB.
MyDateToAdd=3D" & MyMonthValue & "/" & MyDayValue & "/" MyYearValue & "
should read
MyDateToAdd=3DMyMonthValue & "/" & MyDayValue & "/" & MyYearValue

Jean

Hi Jean
Thank you for your answer

Looks like this is the way
Please take a moment to answer this
The code is in a VB DLL. the dadabase SQLServer

Is it possible to do something like this?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dim MyDateToAdd as date

day(MyDateToAdd ) =3D MyMonthValue
month(MyDateToAdd ) =3D MyDayValue
year(MyDateToAdd ) =3D MyYearValue

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I know this does not work but is there a way to do that?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I tried
format(MyDateToAdd,"mm/dd/yyyy")
MyDateToAdd=3D" & MyMonthValue & "/" & MyDayValue & "/" MyYearValue & "
No Luck

Anyway
Thanks again

Best regards
Nikos



At 11:24 =F0=EC 9/1/2003, you wrote:
>Totally control the way the user enters the date. Have three list/menu
boxes
>on your forms for day, month, year. Force the user to select the
appropriate
>item from the lists. That way you know exactly what you are getting 
and
>there is less opportunity for user error.
>
>Jean
>
>Hi
>
>I need a good advice about what do you suggest as best.
>In an Intranet some clients use different regional settings.
>How can I ensure that a date is properly added to a database in the
>database (server) .
>I have used format(my_date," different formats  ") but still I am 
having
>problems sometimes
>
>Any suggestions will be very much appreciated or links to where I can 
read
>about it
>
>Best regards
>
>Nikos
>
>
>
>
>
>This e-mail and any files transmitted with it are confidential and 
intended
>solely for the use of the individual or entity to whom they are 
addressed
>If you have received this e-mail in error please notify
>seafish@s...
>
>If the content is not about the business of the Sea Fish Industry 
Authority
>or the sea fish industry then the message is neither from nor 
sanctioned
>by the Sea Fish Industry Authority.
>
>Working with the Seafood industry to satisfy consumers,
>raise standards, improve efficiency and secure a sustainable future.
>Web Site:  www.seafish.co.uk
>




		 
This e-mail and any files transmitted with it are confidential and 
intended
solely for the use of the individual or entity to whom they are 
addressed
If you have received this e-mail in error please notify
seafish@s...

If the content is not about the business of the Sea Fish Industry 
Authority
or the sea fish industry then the message is neither from nor 
sanctioned
by the Sea Fish Industry Authority. 

Working with the Seafood industry to satisfy consumers,
raise standards, improve efficiency and secure a sustainable future. 
Web Site:  www.seafish.co.uk
Message #5 by Nikos <pappas@c...> on Thu, 09 Jan 2003 19:17:05 +0200
Hi Jean

Sorry for my mistake
I swapped the values in the email message writing in a hurry
in the code it's fine
I need to know for sure if it has to be done before or after
  ( formating the MyDateToAdd )
or if it is not necessary at all
so if someone can please comment on that.

Thanks a lot for your time and help

Best regards

Nikos


At 04:59 =EC=EC 9/1/2003, you wrote:
>You seem to have swopped the day and month values. You have got day =3D My
>MonthValue. Is this the cause of the problem?
>
>The format code should go after you have written the date, not before. Not
>certain you need it anyway. If I'm wrong can someone tell me.
>
>You've missed an ampersand in this line. You don't put quotes round
>variables in VB.
>MyDateToAdd=3D" & MyMonthValue & "/" & MyDayValue & "/" MyYearValue & "
>should read
>MyDateToAdd=3DMyMonthValue & "/" & MyDayValue & "/" & MyYearValue
>
>Jean
>
>Hi Jean
>Thank you for your answer
>
>Looks like this is the way
>Please take a moment to answer this
>The code is in a VB DLL. the dadabase SQLServer
>
>Is it possible to do something like this?
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>dim MyDateToAdd as date
>
>day(MyDateToAdd ) =3D MyMonthValue
>month(MyDateToAdd ) =3D MyDayValue
>year(MyDateToAdd ) =3D MyYearValue
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>I know this does not work but is there a way to do that?
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>I tried
>format(MyDateToAdd,"mm/dd/yyyy")
>MyDateToAdd=3D" & MyMonthValue & "/" & MyDayValue & "/" MyYearValue & "
>No Luck
>
>Anyway
>Thanks again
>
>Best regards
>Nikos
>
>
>
>At 11:24 =F0=EC 9/1/2003, you wrote:
> >Totally control the way the user enters the date. Have three list/menu
>boxes
> >on your forms for day, month, year. Force the user to select the
>appropriate
> >item from the lists. That way you know exactly what you are getting and
> >there is less opportunity for user error.
> >
> >Jean
> >
> >Hi
> >
> >I need a good advice about what do you suggest as best.
> >In an Intranet some clients use different regional settings.
> >How can I ensure that a date is properly added to a database in the
> >database (server) .
> >I have used format(my_date," different formats  ") but still I am having
> >problems sometimes
> >
> >Any suggestions will be very much appreciated or links to where I can
 read
> >about it
> >
> >Best regards
> >
> >Nikos
> >
> >
> >
> >
> >
> >This e-mail and any files transmitted with it are confidential and
 intended
> >solely for the use of the individual or entity to whom they are addressed
> >If you have received this e-mail in error please notify
> >seafish@s...
> >
> >If the content is not about the business of the Sea Fish Industry
 Authority
> >or the sea fish industry then the message is neither from nor sanctioned
> >by the Sea Fish Industry Authority.
> >
> >Working with the Seafood industry to satisfy consumers,
> >raise standards, improve efficiency and secure a sustainable future.
> >Web Site:  www.seafish.co.uk
> >
>
>
>
>
>
>This e-mail and any files transmitted with it are confidential and intended
>solely for the use of the individual or entity to whom they are addressed
>If you have received this e-mail in error please notify
>seafish@s...
>
>If the content is not about the business of the Sea Fish Industry Authority
>or the sea fish industry then the message is neither from nor sanctioned
>by the Sea Fish Industry Authority.
>
>Working with the Seafood industry to satisfy consumers,
>raise standards, improve efficiency and secure a sustainable future.
>Web Site:  www.seafish.co.uk
>


Message #6 by Jean Halstad <J_Halstad@S...> on Fri, 10 Jan 2003 09:21:04 -0000
If you use the format code you must use it after you have written 
variable=3D.
The only reason to use this is to ensure the variable is recognised as 
a
date. You can check whether it is a date by writing

if isdate then
	response.write "yes"
else
	response.write "no"
end if

after the formatting code. Test the page and you should get the answer 
yes.
Now delete the if statement. If SQL does not recognise the variable as 
a
date then it will return a type conversion error. Just try it and see 
what
happens.

Jean

-----Original Message-----
From: Nikos [mailto:pappas@c...]
Sent: 09 January 2003 17:17
To: ASP Databases
Subject: [asp_databases] RE: Dates and Regional Settings


Hi Jean

Sorry for my mistake
I swapped the values in the email message writing in a hurry
in the code it's fine
I need to know for sure if it has to be done before or after
  ( formating the MyDateToAdd )
or if it is not necessary at all
so if someone can please comment on that.

Thanks a lot for your time and help

Best regards

Nikos


At 04:59 =EC=EC 9/1/2003, you wrote:
>You seem to have swopped the day and month values. You have got day 
=3D My
>MonthValue. Is this the cause of the problem?
>
>The format code should go after you have written the date, not before. 
Not
>certain you need it anyway. If I'm wrong can someone tell me.
>
>You've missed an ampersand in this line. You don't put quotes round
>variables in VB.
>MyDateToAdd=3D" & MyMonthValue & "/" & MyDayValue & "/" MyYearValue & 
"
>should read
>MyDateToAdd=3DMyMonthValue & "/" & MyDayValue & "/" & MyYearValue
>
>Jean
>
>Hi Jean
>Thank you for your answer
>
>Looks like this is the way
>Please take a moment to answer this
>The code is in a VB DLL. the dadabase SQLServer
>
>Is it possible to do something like this?
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>dim MyDateToAdd as date
>
>day(MyDateToAdd ) =3D MyMonthValue
>month(MyDateToAdd ) =3D MyDayValue
>year(MyDateToAdd ) =3D MyYearValue
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>I know this does not work but is there a way to do that?
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>I tried
>format(MyDateToAdd,"mm/dd/yyyy")
>MyDateToAdd=3D" & MyMonthValue & "/" & MyDayValue & "/" MyYearValue & 
"
>No Luck
>
>Anyway
>Thanks again
>
>Best regards
>Nikos
>
>
>
>At 11:24 =F0=EC 9/1/2003, you wrote:
> >Totally control the way the user enters the date. Have three 
list/menu
>boxes
> >on your forms for day, month, year. Force the user to select the
>appropriate
> >item from the lists. That way you know exactly what you are getting 
and
> >there is less opportunity for user error.
> >
> >Jean
> >
> >Hi
> >
> >I need a good advice about what do you suggest as best.
> >In an Intranet some clients use different regional settings.
> >How can I ensure that a date is properly added to a database in the
> >database (server) .
> >I have used format(my_date," different formats  ") but still I am 
having
> >problems sometimes
> >
> >Any suggestions will be very much appreciated or links to where I 
can
read
> >about it
> >
> >Best regards
> >
> >Nikos
> >
> >
> >
> >
> >
> >This e-mail and any files transmitted with it are confidential and
intended
> >solely for the use of the individual or entity to whom they are 
addressed
> >If you have received this e-mail in error please notify
> >seafish@s...
> >
> >If the content is not about the business of the Sea Fish Industry
Authority
> >or the sea fish industry then the message is neither from nor 
sanctioned
> >by the Sea Fish Industry Authority.
> >
> >Working with the Seafood industry to satisfy consumers,
> >raise standards, improve efficiency and secure a sustainable future.
> >Web Site:  www.seafish.co.uk
> >
>
>
>
>
>
>This e-mail and any files transmitted with it are confidential and 
intended
>solely for the use of the individual or entity to whom they are 
addressed
>If you have received this e-mail in error please notify
>seafish@s...
>
>If the content is not about the business of the Sea Fish Industry 
Authority
>or the sea fish industry then the message is neither from nor 
sanctioned
>by the Sea Fish Industry Authority.
>
>Working with the Seafood industry to satisfy consumers,
>raise standards, improve efficiency and secure a sustainable future.
>Web Site:  www.seafish.co.uk
>




		 
This e-mail and any files transmitted with it are confidential and 
intended
solely for the use of the individual or entity to whom they are 
addressed
If you have received this e-mail in error please notify
seafish@s...

If the content is not about the business of the Sea Fish Industry 
Authority
or the sea fish industry then the message is neither from nor 
sanctioned
by the Sea Fish Industry Authority. 

Working with the Seafood industry to satisfy consumers,
raise standards, improve efficiency and secure a sustainable future. 
Web Site:  www.seafish.co.uk

  Return to Index