Page 1 of 2
Dating problem! - Help me!
Posted: Mon Jun 01, 2009 4:14 pm
by Rathinagiri
Hey! Don't look at me like that! This thing is serious.
I want to know how to solve the date 'format' differences between various country styles.
How can we know about the default date format from the Regional Settings from the Control Panel. I want to do date calculations involving ctod() functions also. It gives different results when I choose different date formats.
eg.,
set date ital
ctod("01-01-2000")
is different from
set date usa
ctod("01-01-2000")
Please help me in this regard. Simply because of this, I had released my latest Interest(ing) Calculator software allowing only 'dd-mm-yyyy' format.
Re: Dating problem! - Help me!
Posted: Mon Jun 01, 2009 4:29 pm
by sudip
Hello Rathi,
I don't know how to get regional setting format.
My simple solution is ctod("yyyymmdd") format. My favorite function is DTOS() not DTOC().
You might have noticed, I modified your C2SQL() function as:-
Code: Select all
...
case Valtype(Value) == "D"
if !empty(Value)
cValue := "'"+DTOS(value)+"'"
else
cValue := "'00000000'"
endif
...
Best of Luck for your Dating!
Regards.
Sudip
Re: Dating problem! - Help me!
Posted: Mon Jun 01, 2009 5:17 pm
by Rathinagiri
Thanks a lot Sudip. I will try and come to you with my doubts.
As of now, I wish to know about the reverse part; ie., Is there a function like stod("yyyymmdd") returning a date.
Re: Dating problem! - Help me!
Posted: Mon Jun 01, 2009 5:40 pm
by esgici
Hi Rathi
Hrb_Doc wrote:STOD : Convert ANSI date string to Harbour date
Usage:
SYNTAX : STOD ([<cAnsiDate>]) -> dDate
ARGUMENTS : <cAnsiDate> Designates the character string that contains a date in the ANSI format "YYYYMMDD" that is to be converted into the xHarbour date format.
RETURNS : STOD() returns the <cAnsiDate> character string in the corresponding xHarbour date format.
DESCRIPTION : STOD() converts an ANSI date created by the CA-Clipper DTOS() function,back into the standard date format. If the ANSI date is invalid, a null date is returned.
Regards
--
Esgici
Re: Dating problem! - Help me!
Posted: Mon Jun 01, 2009 6:19 pm
by Rathinagiri
Thanks Esgici. I don't see this function in Harbour website Doc.
Re: Dating problem! - Help me!
Posted: Mon Jun 01, 2009 8:57 pm
by mustafa
Hello rathinagiri
Give you this small example, if you have
can be used with SET DATE ANSI can add dates
SET CENTURY ON
SET DATE FRENCH
@ 90,275 LABEL LABEL_1 VALUE DTOC(date()) // Fecha de Hoy - Today's Date
FECHA_F = DATE()
SET DATE ANSI
dia01 = FECHA_F+24 // Fecha de Hoy + 24 dias - Today's Date + 24 days
SET CENTURY ON
SET DATE FRENCH
FECHA1=DTOC(dia01)
@ 170,275 LABEL LABEL_3 VALUE FECHA1 // La Fecha Nueva sumada - New Date added
Regards
Mustafa
Re: Dating problem! - Help me!
Posted: Tue Jun 02, 2009 4:09 am
by Rathinagiri
Thanks for the help.
Now, how can we get the format from the regional settings?
Re: Dating problem! - Help me!
Posted: Tue Jun 02, 2009 4:13 am
by Rathinagiri
Now, in my Vista system, the date format settings is in,
HKEY_CURRENT_USER\Control Panel\International\sShortDate
What about the other versions?
Re: Dating problem! - Help me!
Posted: Tue Jun 02, 2009 7:36 am
by gfilatov
rathinagiri wrote:Now, in my Vista system, the date format settings is in,
HKEY_CURRENT_USER\Control Panel\International\sShortDate
What about the other versions?
Hi Rathinagiri,
The equal Registry key on my Win98SE also.

Re: Dating problem! - Help me!
Posted: Tue Jun 02, 2009 8:10 am
by Rathinagiri
Yes, this is the same for my another XP machine too!
So, I think we can utilize the same to find out the user's date format.
Thanks Grigory Filatov for the report.