Dating problem! - Help me!

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Dating problem! - Help me!

Post 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Dating problem! - Help me!

Post 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! :lol:

Regards.

Sudip
With best regards,
Sudip
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Dating problem! - Help me!

Post 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Dating problem! - Help me!

Post 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
Last edited by esgici on Mon Jun 01, 2009 6:26 pm, edited 1 time in total.
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Dating problem! - Help me!

Post by Rathinagiri »

Thanks Esgici. I don't see this function in Harbour website Doc.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
mustafa
Posts: 1177
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Dating problem! - Help me!

Post 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
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Dating problem! - Help me!

Post by Rathinagiri »

Thanks for the help.

Now, how can we get the format from the regional settings?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Dating problem! - Help me!

Post 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?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
gfilatov
Posts: 1114
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Dating problem! - Help me!

Post 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. :arrow:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Dating problem! - Help me!

Post 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply