rowfilter date formats

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Forgive me if this is not the right place to post this. I've already had it
booted from the vb.database forum.
------------------------------
I'm thoroughly confused.
The following expression works fine as a table view rowfilter when locale is
set to US.
dateField <= "#" & Now.ToShortDateString & "#"
It fails when you set your locale to German. (Most embarassing for my client
on a recent show and tell to his peers in Europe.:-)))

Error is string is not recognized as date. Presumably because the day and
month are switched in most of the world from what we do in the US. Luckily we
"tested" this after the 12th of the month!!!!

The following works:
Dim noww As String = Now.ToString("MM/dd/yyyy")

dateField <= "#" & noww & "#"

At first I was puzzled because noww is e.g. 09.30.2006. On further reading
the doco I see that the locale date separator is used.

So the question is simple. Have I now stumbled across a formatting of the
test string that will work regardless of the locale's date seperator, or have
I encountered a bug, or what?

More to the point where can i find a good definition of the syntax and
semantics of rowFilter when dates are involved?

Note MS Lurkers - as usual the VS 2005 help is as useless as <substitute
your favorite off color expression for these circumstances>. It only shows an
example and has nothing on globalization. (And this only after you follow
your nose around the barn to "expressions"!)

To use my recurring mantra these days - Yet another reason why VSTS 2005 is
not ready from prime time:-)
--
Regards,
Al Christoph
Senior Consultant
Three Bears Software, LLC
just right software @ just right prices @ 3bears.biz
Microsoft Certified Partner (ISV)
Coming soon: Windows Mail for Vista.
 
Al,

It is anoying for all others in the world, the expression works only in that
local USA date time format.

Cor
 
Hi Al,

If you've read the help file you would know that it accepts ony this date
format. Is it bad? No, it is very good to avoid the chaos.
You are free to parse date beforhand, converto it to
CultureInfo.InvariantCulture string format and pass it to Filter property.
I think the only improvement should be done in direction of
parametrisation - so you would pass the date value instead of its string
representation.
 
Which help file?

I looked up rowfilter. It said lookup "expressions" I looked up expressions
and got one or two lines which just gave an example with ## and no commentary
what so ever.

I even googled which normally is quite helpful (especially compared to using
VSTS 2005 help search.) Nada.

--
Regards,
Al Christoph
Senior Consultant
Three Bears Software, LLC
just right software @ just right prices @ 3bears.biz
Microsoft Certified Partner (ISV)
Coming soon: Windows Mail for Vista.



Miha Markic said:
Hi Al,

If you've read the help file you would know that it accepts ony this date
format. Is it bad? No, it is very good to avoid the chaos.
You are free to parse date beforhand, converto it to
CultureInfo.InvariantCulture string format and pass it to Filter property.
I think the only improvement should be done in direction of
parametrisation - so you would pass the date value instead of its string
representation.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Al Christoph said:
Forgive me if this is not the right place to post this. I've already had
it
booted from the vb.database forum.
------------------------------
I'm thoroughly confused.
The following expression works fine as a table view rowfilter when locale
is
set to US.
dateField <= "#" & Now.ToShortDateString & "#"
It fails when you set your locale to German. (Most embarassing for my
client
on a recent show and tell to his peers in Europe.:-)))

Error is string is not recognized as date. Presumably because the day and
month are switched in most of the world from what we do in the US. Luckily
we
"tested" this after the 12th of the month!!!!

The following works:
Dim noww As String = Now.ToString("MM/dd/yyyy")

dateField <= "#" & noww & "#"

At first I was puzzled because noww is e.g. 09.30.2006. On further reading
the doco I see that the locale date separator is used.

So the question is simple. Have I now stumbled across a formatting of the
test string that will work regardless of the locale's date seperator, or
have
I encountered a bug, or what?

More to the point where can i find a good definition of the syntax and
semantics of rowFilter when dates are involved?

Note MS Lurkers - as usual the VS 2005 help is as useless as <substitute
your favorite off color expression for these circumstances>. It only shows
an
example and has nothing on globalization. (And this only after you follow
your nose around the barn to "expressions"!)

To use my recurring mantra these days - Yet another reason why VSTS 2005
is
not ready from prime time:-)
--
Regards,
Al Christoph
Senior Consultant
Three Bears Software, LLC
just right software @ just right prices @ 3bears.biz
Microsoft Certified Partner (ISV)
Coming soon: Windows Mail for Vista.
 
Hi Al,

Al Christoph said:
Which help file?

I looked up rowfilter. It said lookup "expressions" I looked up
expressions
and got one or two lines which just gave an example with ## and no
commentary
what so ever.

I even googled which normally is quite helpful (especially compared to
using
VSTS 2005 help search.) Nada.

Hm, seems that there is really no reference to cultures in Expression topic.
I am sure I read something about this in help files, not sure where though.
Perhaps you might suggest docs improvement to feedback center...
 
instead of using

Now.ToShortDateString

you can try using

Now.ToString ( formatSpecifier, cultureInfo )

something like

Now.ToString ( "d", "de-DE" )
 
Rey,

I don't know if it is your page, it is really nice and gives a lot of
information I was always curious about, but one hour later can make it even
more informative.

Cor
 
Al

oops, I posted a wrong example. Use below instead

Now.ToString ( "d", new CultureInfo ( "de-DE" ) )


Cor

Sorry maybe I missed something, but I didn't get what you meant. Can
you please give some more feedback?
 
ReyN,

I see now that you are using a real clock related to probably your timezone.

At the moment I saw it, it was showing 12.45 or something. That hour after
the 12 clock is very confusing in some cultures, if you don't know the
am/pm. However now I see it is a real clock and see for most countries 23.47
and it is clear.

For me funny is that have helped me to show why I was in past always
confused with the pm/am. In my country we use in the spoken way the same as
on the page for South Africa (afrikaans) 'nm/vm'. The difference with 'am'
means that 'nm' means translated after noon (namiddag) and vm (voormiddag)
post noon.

Cor
 
Back
Top