Discussion:
Converting sqldate
Mr. Bart Pietercil
2006-10-31 23:03:26 UTC
Permalink
Hi,

what would be the best place to put the code for converting the
sqldate postgres is sending me to the format I want it to be
displayed when I'm using visual binding between the cache and the
pgsqlfield that needs to display the formatted date?

tia

Bart
Aliacta Support
2006-11-01 10:35:08 UTC
Permalink
Post by Mr. Bart Pietercil
what would be the best place to put the code for converting the
sqldate postgres is sending me to the format I want it to be
displayed when I'm using visual binding between the cache and the
pgsqlfield that needs to display the formatted date?
I would subclass the pgSQLfield and put that code in its TextChange event.
(You may add code that checks the caches DataTypes array to
automatically format any data type (date, text, number) the way you
like it and set the pgSQLfield's Mask property accordingly. Then you
have an universal pgSQLfield for your purposes.)

Marc
Aliacta Support
2006-11-01 10:47:00 UTC
Permalink
The ultimate place to put that code would be in the PopulateField
method of your own subclass of the EditField that implements the
pgSQLfieldReceiver interface. (p.91 in the manual) I.e. you would
no longer use the pgSQLfield but make your own.

Marc
Sebastian von Ulmenstein
2006-11-01 19:48:03 UTC
Permalink
Just to be complete: You could leave the fields alone and use (quoting from
the Postgres manual):

16.4.8.2. Locale and Formatting
DateStyle (string)
Sets the display format for date and time values, as well as the rules for
interpreting ambiguous
date input values. For historical reasons, this variable contains two
independent components: the
output format specification (ISO, Postgres, SQL, or German) and the
input/output specifica-
tion for year/month/day ordering (DMY, MDY, or YMD). These can be set
separately or together.
The keywords Euro and European are synonyms for DMY; the keywords US,
NonEuro, and
NonEuropean are synonyms for MDY. See Section 8.5 for more information. The
default is ISO,
MDY.

Regards
Sebastian




Am 01.11.2006 11:47 Uhr schrieb "Aliacta Support" unter
Post by Aliacta Support
The ultimate place to put that code would be in the PopulateField
method of your own subclass of the EditField that implements the
pgSQLfieldReceiver interface. (p.91 in the manual) I.e. you would
no longer use the pgSQLfield but make your own.
Marc
_______________________________________________
Postgresql mailing list
http://aliacta.com/mailman/listinfo/postgresql_aliacta.com
Mark Lubratt
2006-11-01 21:36:03 UTC
Permalink
Better yet. I haven't seen anyone mention this:

Look up the to_char function. You can format the date anyway you
like in the SQL statement.

HTH!
Mark
Post by Sebastian von Ulmenstein
Just to be complete: You could leave the fields alone and use
(quoting from
16.4.8.2. Locale and Formatting
DateStyle (string)
Sets the display format for date and time values, as well as the rules for
interpreting ambiguous
date input values. For historical reasons, this variable contains two
independent components: the
output format specification (ISO, Postgres, SQL, or German) and the
input/output specifica-
tion for year/month/day ordering (DMY, MDY, or YMD). These can be set
separately or together.
The keywords Euro and European are synonyms for DMY; the keywords US,
NonEuro, and
NonEuropean are synonyms for MDY. See Section 8.5 for more
information. The
default is ISO,
MDY.
Regards
Sebastian
Am 01.11.2006 11:47 Uhr schrieb "Aliacta Support" unter
Post by Aliacta Support
The ultimate place to put that code would be in the PopulateField
method of your own subclass of the EditField that implements the
pgSQLfieldReceiver interface. (p.91 in the manual) I.e. you would
no longer use the pgSQLfield but make your own.
Marc
_______________________________________________
Postgresql mailing list
http://aliacta.com/mailman/listinfo/postgresql_aliacta.com
_______________________________________________
Postgresql mailing list
http://aliacta.com/mailman/listinfo/postgresql_aliacta.com
Loading...