Showing posts with label date. Show all posts
Showing posts with label date. Show all posts

Thursday, 8 March 2012

Confusion with date attributes and member name / value

Hi,

I'm just wondering about how the best approach is to create a date member... The member name has to be a string, so there seams to be no way that a client application can decide how to display a date (by it's regional settings). You have to do the formatting in the DSV. You can use some formatting with the member value but this isn't used by client applications by default (is there any application using it out there, yet?).

So what's the best approach here?

Thanks,

Hi Thomas,

Could Translations help you (i.e defining different captions for a given date, by locale)?

|||

Deepak,

yes that might be a solution... However this might be a problem with other datatypes as well... I just think about an attribute "Size" which might be formatted in differently in different regions (with a comma or point as decimal seperator, ...). So everything has to be done with translations? Not a very good approach...

Thanks anyway...

Saturday, 25 February 2012

confused about date values

I tried running this query :
select count(*) from table1 where dateadded > 1/1/2004
First of all, it worked. I didnt expect to 'cos i didnt put the quotes
around the date.
Secondly it returned a different result set than when I did include the date
select count(*) from table1 where dateadded > '1/1/2004'
CreateDate is a smalldatetime datatype.
Can someone explain this behaviour? Using SQL 2K> select count(*) from table1 where dateadded > 1/1/2004
This is equivalent to:
select count(*) from table1 where dateadded > 0
because 1/1/2004 is evaluated as an arithmetic expression without the
quotes.
The best way to specify date constants is in yyyymmdd format so that the
value is interpreted consistently regardless of the data format settings:
select count(*) from table1 where dateadded > '20040101'
Hope this helps.
Dan Guzman
SQL Server MVP
"Hassan" <Hassan@.hotmail.com> wrote in message
news:uKKBORXjGHA.4776@.TK2MSFTNGP05.phx.gbl...
>I tried running this query :
> select count(*) from table1 where dateadded > 1/1/2004
> First of all, it worked. I didnt expect to 'cos i didnt put the quotes
> around the date.
> Secondly it returned a different result set than when I did include the
> date
> select count(*) from table1 where dateadded > '1/1/2004'
> CreateDate is a smalldatetime datatype.
> Can someone explain this behaviour? Using SQL 2K
>|||Single quotation marks must be placed around all char, nchar, varchar,
nvarchar, text, datetime, and smalldatetime data.
As Mr. Guzman stated not following this practice in regards to a date would
cause SQL to evaluate the string as an equation.
"Hassan" wrote:

> I tried running this query :
> select count(*) from table1 where dateadded > 1/1/2004
> First of all, it worked. I didnt expect to 'cos i didnt put the quotes
> around the date.
> Secondly it returned a different result set than when I did include the da
te
> select count(*) from table1 where dateadded > '1/1/2004'
> CreateDate is a smalldatetime datatype.
> Can someone explain this behaviour? Using SQL 2K
>
>

Confused :-(

Having serious problems trying to insert date into database using sqladapter.update method gives an error saying "Converting DateTime from Character string". the funniest thing is that it works on my developement box, but when i upload to the server with thesame settings in my development box, it does not work.is the default culture of the server different than your development box ?|||use fully specified globalization in web.config of your application