Re: datediff() and isdate() not working with hungarian date format (VB6)
- From: "Christoph Guentner" <no.spam.mail@xxxxxxx>
- Date: Fri, 11 Aug 2006 18:12:46 +0200
I think it's always best to pick a date format from the drop-down list inYes, I totally agree, but I have no impact on what the user of my program do
the Regional Settings rather than creating a custom setting
set as date format on theirs computers.
Well, I will add a checking and a prompt for the user.
Regards,
Christoph
"Tony Proctor" <tony_proctor@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im
Newsbeitrag news:Of1C36VvGHA.1808@xxxxxxxxxxxxxxxxxxxxxxx
The trailing third separator _will_ cause problems Chistoph. I don't think
that was mentioned in your original post.
Although you can set a short date format of, say, "DD/MM/YYYY/", and
CStr/Format will generate it, it appears CDate/IsDate do not expect to see
it.
I think it's always best to pick a date format from the drop-down list in
the Regional Settings rather than creating a custom setting
Tony Proctor
"Christoph Guentner" <no.spam.mail@xxxxxxx> wrote in message
news:#cWf8TVvGHA.976@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for your answer,format
I develop an intenational program, on a german Win XP.
When I set in the control panel Hungry and then change the short date
toI
JJJJ. MM. TT.
Then Datediff() and and isdate() do not work with strings.
and assigning s string to a date variable does not workeither, so the
conversion is not working.
E.g.
Dim t1 As String
Dim d1 As Date
d1 = DateSerial(2005, 10, 2) 'ok
t1 = DateSerial(2005, 10, 2) 'ok
d1 = t1 'error 13
With the date format
M/ T/ JJJJ
this is working, but e.g.
M/ T/ JJJJ/
is not.
So it seems, if the date format contains at least one space and has a
character e..g . or / at the end, this causes problems.
I do have to use strings, because I retrieve the date strings from files.
Regards,
Christoph Guentner
"Tony Proctor" <tony_proctor@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im
Newsbeitrag news:eJTXaaUvGHA.4688@xxxxxxxxxxxxxxxxxxxxxxx
DateDiff is designed to work with real 'Date' items Christoph, not
'String'
items. If you pass it a String then it will implicitly try to convert
it
to
a Date first, and that conversation will be subject to your current
locale.
Most of the VB run-time functions are aware of your locale. Hence, if
you're
actually working with an Hungarian locale setting then IsDate, CDate,
CStr,
etc., should all behave correctly. Sorry I can't try to reproduce your
problem here as I cannot set an Hungarian locale on my machine.
However,
whatcan, and do, test my code under other West-European locales. Spaces,
for
instance, should not be causing any particular problem. IsDate and
CDate
would both work with a string of, say "10 / 8 / 2006" here.
Can you confirm what your locale setting is in the Control Panel, and
notyour date/time format settings are?
Tony Proctor
"Christoph Guentner" <no.spam.mail@xxxxxxx> wrote in message
news:Oa$S4jSvGHA.976@xxxxxxxxxxxxxxxxxxxxxxx
Hello,
in Hungry some users have the date format
yyyy. mm. dd.
Yes, there are spaces.
With this the functions datediff() and isdate() do not work.
datediff() returns an error and isdate() returns always false.
A assigning a string that contains such a date to a date variable is
Iworking:
dim t as string
dim d as date
t= "2006. 08. 08"
d = t '=> not working => error
d = DateSerial(2006,8,8) 'is working. d contains 2006. 08. 08
So is there a workaround for this?
Are there Win Api functions for this that works correct?
I use VB6, SP6 on Win XP Sp2
Thank you
"Tony Proctor" <tony_proctor@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im
Newsbeitrag news:eJTXaaUvGHA.4688@xxxxxxxxxxxxxxxxxxxxxxx
DateDiff is designed to work with real 'Date' items Christoph, not
'String'
items. If you pass it a String then it will implicitly try to convert
it
to
a Date first, and that conversation will be subject to your current
locale.
Most of the VB run-time functions are aware of your locale. Hence, if
you're
actually working with an Hungarian locale setting then IsDate, CDate,
CStr,
etc., should all behave correctly. Sorry I can't try to reproduce your
problem here as I cannot set an Hungarian locale on my machine.
However,
whatcan, and do, test my code under other West-European locales. Spaces,
for
instance, should not be causing any particular problem. IsDate and
CDate
would both work with a string of, say "10 / 8 / 2006" here.
Can you confirm what your locale setting is in the Control Panel, and
notyour date/time format settings are?
Tony Proctor
"Christoph Guentner" <no.spam.mail@xxxxxxx> wrote in message
news:Oa$S4jSvGHA.976@xxxxxxxxxxxxxxxxxxxxxxx
Hello,
in Hungry some users have the date format
yyyy. mm. dd.
Yes, there are spaces.
With this the functions datediff() and isdate() do not work.
datediff() returns an error and isdate() returns always false.
A assigning a string that contains such a date to a date variable is
working:
dim t as string
dim d as date
t= "2006. 08. 08"
d = t '=> not working => error
d = DateSerial(2006,8,8) 'is working. d contains 2006. 08. 08
So is there a workaround for this?
Are there Win Api functions for this that works correct?
I use VB6, SP6 on Win XP Sp2
Thank you
.
- References:
- datediff() and isdate() not working with hungarian date format (VB6)
- From: Christoph Guentner
- Re: datediff() and isdate() not working with hungarian date format (VB6)
- From: Tony Proctor
- Re: datediff() and isdate() not working with hungarian date format (VB6)
- From: Christoph Guentner
- Re: datediff() and isdate() not working with hungarian date format (VB6)
- From: Tony Proctor
- datediff() and isdate() not working with hungarian date format (VB6)
- Prev by Date: Re: datediff() and isdate() not working with hungarian date format (VB6)
- Next by Date: New office 2003 look not supported in VC.NET 2005
- Previous by thread: Re: datediff() and isdate() not working with hungarian date format (VB6)
- Next by thread: New office 2003 look not supported in VC.NET 2005
- Index(es):
Relevant Pages
|