aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/formatting.h
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2000-01-25 23:53:56 +0000
committerBruce Momjian <bruce@momjian.us>2000-01-25 23:53:56 +0000
commitb866d2e2d79416f8497e4dffa7e800298d018f6c (patch)
treeb633b1415e4b916aaff71d86dc8cee4dba0258e9 /src/include/utils/formatting.h
parent90aaad06cf25753e10717ac7eb727cd65d8d5726 (diff)
downloadpostgresql-b866d2e2d79416f8497e4dffa7e800298d018f6c.tar.gz
postgresql-b866d2e2d79416f8497e4dffa7e800298d018f6c.zip
as attache of this mail is patch (to the main tree) with to_char's
family functions. Contain: conversion from a datetype to formatted text: to_char( datetime, text) to_char( timestamp, text) to_char( int4, text) to_char( int8, text) to_char( float4, text) to_char( float8, text) to_char( numeric, text) vice versa: to_date ( text, text) to_datetime ( text, text) to_timestamp ( text, text) to_number ( text, text) (convert to numeric) PostgreSQL to_char is very compatible with Oracle's to_char(), but not total exactly (now). Small differentions are in number formating. It will fix in next to_char() version. ! If will this patch aplly to the main tree, must be delete the current to_char version in contrib (directory "dateformat" and note in contrib's README), this patch not erase it (sorry Bruce). The patch patching files: doc/src/sgml/func.sgml ^^^^^^^^ Hmm, I'm not sure if my English... :( Check it anyone (volunteer)? Thomas, it is right? SGML is not my primary lang and compile the current PG docs tree is very happy job (hard variables setting in docs/sgml/Makefile --> HSTYLE= /home/users/t/thomas/.... :-) What add any definition to global configure.in and set Makefiles in docs tree via ./configure? src/backend/utils/adt/Makefile src/backend/utils/adt/formatting.c src/include/catalog/pg_proc.h src/include/utils/formatting.h Karel Zak <zakkr@zf.jcu.cz> http://home.zf.jcu.cz/~zakkr/
Diffstat (limited to 'src/include/utils/formatting.h')
-rw-r--r--src/include/utils/formatting.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/include/utils/formatting.h b/src/include/utils/formatting.h
new file mode 100644
index 00000000000..b5b1a5ff1fa
--- /dev/null
+++ b/src/include/utils/formatting.h
@@ -0,0 +1,31 @@
+
+/* -----------------------------------------------------------------------
+ * formatting.h
+ *
+ * $Id: formatting.h,v 1.1 2000/01/25 23:53:56 momjian Exp $
+ *
+ *
+ * The PostgreSQL routines for a DateTime/int/float/numeric formatting,
+ * inspire with Oracle TO_CHAR() / TO_DATE() / TO_NUMBER() routines.
+ *
+ * 1999 Karel Zak "Zakkr"
+ *
+ * -----------------------------------------------------------------------
+ */
+
+#ifndef _FORMATTING_H_
+#define _FORMATTING_H_
+
+extern text *datetime_to_char(DateTime *dt, text *fmt);
+extern text *timestamp_to_char(time_t dt, text *fmt);
+extern DateTime *to_datetime(text *date_str, text *fmt);
+extern time_t to_timestamp(text *date_str, text *fmt);
+extern DateADT to_date(text *date_str, text *fmt);
+extern Numeric numeric_to_number(text *value, text *fmt);
+extern text *numeric_to_char(Numeric value, text *fmt);
+extern text *int4_to_char(int32 value, text *fmt);
+extern text *int8_to_char(int64 *value, text *fmt);
+extern text *float4_to_char(float32 value, text *fmt);
+extern text *float8_to_char(float64 value, text *fmt);
+
+#endif