Where can I set the output format of a database date field ?

  • Thread starter Thread starter David Martin
  • Start date Start date
D

David Martin

I know this is silly but I can't remember where I did this before -
I have a W2K server running IIS and SQL server & IIS with FP 2002
extensions.

The same web page exists on the server and also on my workstation.
The same name for the ODBC data source is used by both machines.

My problem is that on the server the date is output with leading zeroes on
days and months under 10 - on my work station they are not. (A script
processes the output - so I would like it consistant).

I think i set something on the server to get it that way but I can't find
where I did it now,

David.
 
Hi David,

Where does the data have leading zeros?? - the database, the html page????

Anyway it might be the Control Panel->Regional and Language
Options->Customize on the Server.

Regards,
Vijay

Disclaimer: This posting is provided "as is" with no warranties and confers
no rights

--------------------
| From: "David Martin" <[email protected]>
| Subject: Where can I set the output format of a database date field ?
| Date: Mon, 15 Mar 2004 15:02:38 +0100
|
| I know this is silly but I can't remember where I did this before -
| I have a W2K server running IIS and SQL server & IIS with FP 2002
| extensions.
|
| The same web page exists on the server and also on my workstation.
| The same name for the ODBC data source is used by both machines.
|
| My problem is that on the server the date is output with leading zeroes on
| days and months under 10 - on my work station they are not. (A script
| processes the output - so I would like it consistant).
|
| I think i set something on the server to get it that way but I can't find
| where I did it now,
|
| David.
|
|
|
 
The leading zeroes are on the web page when presented from the server (but
not the workstaion)- your suggestion was my first thought - because if it
was I would need to recode the script to cope with both situations.

I did wonder if it was in the ODBS settings - but I don't think so.

p.s. both pages server & workstaton are being viewed from the w/s.
also other clients seem to work fine when the page comes from the
server.

David.
 
Hi David,

This date that you are displaying, is this the System Date or the SQL date?
i.e. are you using <%=Now()%> or Select GetDate() with formatting?

The first one I believe uses the regional setting, where as the second one
would use the ODBC setting if returned as a date field (not an expert on
SQL thought).

So you could actually compare the Control Panel->Regional and Language ->
Options->Customize of the Server and the Workstation and also
compare the "Use regional setting when outputting currency, numbers, dates
and times." in the odbcad32 configuration for the DSN.

Regards,
Vijay

Disclaimer: This posting is provided "as is" with no warranties and confers
no rights

--------------------
| From: "David Martin" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: Re: Where can I set the output format of a database date field ?
| Date: Mon, 15 Mar 2004 21:07:53 +0100
|
| The leading zeroes are on the web page when presented from the server (but
| not the workstaion)- your suggestion was my first thought - because if it
| was I would need to recode the script to cope with both situations.
|
| I did wonder if it was in the ODBS settings - but I don't think so.
|
| p.s. both pages server & workstaton are being viewed from the w/s.
| also other clients seem to work fine when the page comes from the
| server.
|
| David.
|
| | > Hi David,
| >
| > Where does the data have leading zeros?? - the database, the html
page????
| >
| > Anyway it might be the Control Panel->Regional and Language
| > Options->Customize on the Server.
| >
| > Regards,
| > Vijay
| >
| > Disclaimer: This posting is provided "as is" with no warranties and
| confers
| > no rights
| >
| > --------------------
| > | From: "David Martin" <[email protected]>
| > | Subject: Where can I set the output format of a database date field ?
| > | Date: Mon, 15 Mar 2004 15:02:38 +0100
| > |
| > | I know this is silly but I can't remember where I did this before -
| > | I have a W2K server running IIS and SQL server & IIS with FP 2002
| > | extensions.
| > |
| > | The same web page exists on the server and also on my workstation.
| > | The same name for the ODBC data source is used by both machines.
| > |
| > | My problem is that on the server the date is output with leading
zeroes
| on
| > | days and months under 10 - on my work station they are not. (A script
| > | processes the output - so I would like it consistant).
| > |
| > | I think i set something on the server to get it that way but I can't
| find
| > | where I did it now,
| > |
| > | David.
| > |
| > |
| > |
| >
|
|
|
 
The dates are in two database fields of type DateTime.
The regional settings are the same on both machines (U.K.) and the preview
for the short date format previews 09/03/2004 DD/MM/YYYY.

The ODBC settings were slightly different so I made them the same (except
the server has the host set to local).

The select used is the FrontPage default.with no added complexity
fp_sQry="SELECT * FROM RATESView"

So the table is the same table.
the DataSource are as close as possible.
The regional settings are the same.
Both results are being viewed from the same client.
The asp page is a copy of the server page.
also both use the same version of W2K & FP Server Extensions 2002.

I have tried creating two new pages without my processing code and I notice
the my client displays the date with no leading 0 and is displaying
MM/DD/YYY.
Ues I am sure the regional setting is (cut & Paste) DD/MM/yyyy

David.
 
Hi David,

Hmm.. Well there is a possible solution that I used to use long time back,
if you are ready to change the code. The select query can be changed to
return the date in the format you require, but ensure that you convert it
to varchar before returning in the select statement. Hence when it is
passed across different layers (odbc, asp), it remains a string and is not
modified by any of them. Its a WYSIWYG ;)

Let me know if it helps.

Regards,
Vijay

Disclaimer: This posting is provided "as is" with no warranties and confers
no rights

--------------------
| From: "David Martin" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Where can I set the output format of a database date field ?
| Date: Tue, 16 Mar 2004 14:03:48 +0100

| The dates are in two database fields of type DateTime.
| The regional settings are the same on both machines (U.K.) and the preview
| for the short date format previews 09/03/2004 DD/MM/YYYY.
|
| The ODBC settings were slightly different so I made them the same (except
| the server has the host set to local).
|
| The select used is the FrontPage default.with no added complexity
| fp_sQry="SELECT * FROM RATESView"
|
| So the table is the same table.
| the DataSource are as close as possible.
| The regional settings are the same.
| Both results are being viewed from the same client.
| The asp page is a copy of the server page.
| also both use the same version of W2K & FP Server Extensions 2002.
|
| I have tried creating two new pages without my processing code and I
notice
| the my client displays the date with no leading 0 and is displaying
| MM/DD/YYY.
| Ues I am sure the regional setting is (cut & Paste) DD/MM/yyyy
|
| David.
|
| | > Hi David,
| >
| > This date that you are displaying, is this the System Date or the SQL
| date?
| > i.e. are you using <%=Now()%> or Select GetDate() with formatting?
| >
| > The first one I believe uses the regional setting, where as the second
one
| > would use the ODBC setting if returned as a date field (not an expert on
| > SQL thought).
| >
| > So you could actually compare the Control Panel->Regional and Language
->
| > Options->Customize of the Server and the Workstation and also
| > compare the "Use regional setting when outputting currency, numbers,
dates
| > and times." in the odbcad32 configuration for the DSN.
| >
| > Regards,
| > Vijay
| >
| > Disclaimer: This posting is provided "as is" with no warranties and
| confers
| > no rights
| >
| > --------------------
| > | From: "David Martin" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > | Subject: Re: Where can I set the output format of a database date
field
| ?
| > | Date: Mon, 15 Mar 2004 21:07:53 +0100
| > |
| > | The leading zeroes are on the web page when presented from the server
| (but
| > | not the workstaion)- your suggestion was my first thought - because if
| it
| > | was I would need to recode the script to cope with both situations.
| > |
| > | I did wonder if it was in the ODBS settings - but I don't think so.
| > |
| > | p.s. both pages server & workstaton are being viewed from the w/s.
| > | also other clients seem to work fine when the page comes from
the
| > | server.
| > |
| > | David.
| > |
| message
| > | | > | > Hi David,
| > | >
| > | > Where does the data have leading zeros?? - the database, the html
| > page????
| > | >
| > | > Anyway it might be the Control Panel->Regional and Language
| > | > Options->Customize on the Server.
| > | >
| > | > Regards,
| > | > Vijay
| > | >
| > | > Disclaimer: This posting is provided "as is" with no warranties and
| > | confers
| > | > no rights
| > | >
| > | > --------------------
| > | > | From: "David Martin" <[email protected]>
| > | > | Subject: Where can I set the output format of a database date
field
| ?
| > | > | Date: Mon, 15 Mar 2004 15:02:38 +0100
| > | > |
| > | > | I know this is silly but I can't remember where I did this before
-
| > | > | I have a W2K server running IIS and SQL server & IIS with FP 2002
| > | > | extensions.
| > | > |
| > | > | The same web page exists on the server and also on my workstation.
| > | > | The same name for the ODBC data source is used by both machines.
| > | > |
| > | > | My problem is that on the server the date is output with leading
| > zeroes
| > | on
| > | > | days and months under 10 - on my work station they are not. (A
| script
| > | > | processes the output - so I would like it consistant).
| > | > |
| > | > | I think i set something on the server to get it that way but I
can't
| > | find
| > | > | where I did it now,
| > | > |
| > | > | David.
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 
Many thanks for your help Vijay - found where the problem is !

you were on the right track - all of a sudden it came to me - my
international settings are not releverent - it is the IIS anonomous user who
pulls the data from SQL server. - on the server the default local was set to
U.K. and on the Client to USA.

Thanks again for your help.

David.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top