Re: [GENERAL] to_char(timestamp, format) is changing the year!

2014-11-30 Thread Stephen Woodbridge
Hi Adrain, Thank you for the explanation. I was trying to send some data to a Javascript library worked with ISO dates. But you are correct I wanted not IYYY, that totally sliped by me. Thanks, -Steve On 11/30/2014 4:19 PM, Adrian Klaver wrote: On 11/30/2014 01:05 PM, Stephen Woodbri

Re: [GENERAL] to_char(timestamp, format) is changing the year!

2014-11-30 Thread Steve Atkins
On Nov 30, 2014, at 1:05 PM, Stephen Woodbridge wrote: > Hi, > > I am have a problem when I format a timestamp in that it is changing the > year. This can't be right, so either I don't understand You're using "IYYY" which is the "ISO year", which is based on Mondays or Thursdays or something

Re: [GENERAL] to_char(timestamp, format) is changing the year!

2014-11-30 Thread Adrian Klaver
On 11/30/2014 01:05 PM, Stephen Woodbridge wrote: Hi, I am have a problem when I format a timestamp in that it is changing the year. This can't be right, so either I don't understand or I have found a nasty corner case bug. This does not happen on all dates select '2014-12-31 00:00:00'::timest

[GENERAL] to_char(timestamp, format) is changing the year!

2014-11-30 Thread Stephen Woodbridge
Hi, I am have a problem when I format a timestamp in that it is changing the year. This can't be right, so either I don't understand or I have found a nasty corner case bug. This does not happen on all dates select '2014-12-31 00:00:00'::timestamp without time zone, to_char('2014-12-3

Re: [GENERAL] to_char with locale decimal separator

2013-07-30 Thread Adrian Klaver
On 07/30/2013 08:34 AM, Ingmar Brouns wrote: Thanks for your time, appreciate it! As a dirty alternative, you could also do something like: select translate(5.000::text,'.',substr(to_char(.0),2,1)); Not so nice, but would work. Though I still feel there should be a more elegant of doing this.

Re: [GENERAL] to_char with locale decimal separator

2013-07-30 Thread Ingmar Brouns
On Tue, Jul 30, 2013 at 4:42 PM, Adrian Klaver wrote: > On 07/30/2013 03:03 AM, Ingmar Brouns wrote: >> >> On Mon, Jul 29, 2013 at 3:12 PM, Ingmar Brouns wrote: > > >>> >> >> anyone? Giving a locale corresponding textual representation >> of a numerical value keeping the exact nr of decimal digit

Re: [GENERAL] to_char with locale decimal separator

2013-07-30 Thread Adrian Klaver
On 07/30/2013 03:03 AM, Ingmar Brouns wrote: On Mon, Jul 29, 2013 at 3:12 PM, Ingmar Brouns wrote: anyone? Giving a locale corresponding textual representation of a numerical value keeping the exact nr of decimal digits must be a fairly common use case. Would it be an idea to implement a t

Re: [GENERAL] to_char with locale decimal separator

2013-07-30 Thread Ingmar Brouns
On Mon, Jul 29, 2013 at 3:12 PM, Ingmar Brouns wrote: > On Mon, Jul 29, 2013 at 1:24 PM, Ingmar Brouns wrote: >> Hi, >> >> I need to convert some numerical values to text using the decimal >> separator that corresponds to the current locale. However, I do >> not want to lose information by paddin

Re: [GENERAL] to_char with locale decimal separator

2013-07-29 Thread Adrian Klaver
On 07/29/2013 07:27 AM, Ingmar Brouns wrote: On Mon, Jul 29, 2013 at 3:45 PM, Adrian Klaver wrote: On 07/29/2013 04:24 AM, Ingmar Brouns wrote: Hi, This work?: test=> select replace(1.500::text, '.', ','); replace - 1,500 (1 row) that would work, but that requires keeping

Re: [GENERAL] to_char with locale decimal separator

2013-07-29 Thread Ingmar Brouns
On Mon, Jul 29, 2013 at 3:45 PM, Adrian Klaver wrote: > On 07/29/2013 04:24 AM, Ingmar Brouns wrote: >> >> Hi, >> >> I need to convert some numerical values to text using the decimal >> separator that corresponds to the current locale. However, I do >> not want to lose information by padding with

Re: [GENERAL] to_char with locale decimal separator

2013-07-29 Thread Adrian Klaver
On 07/29/2013 04:24 AM, Ingmar Brouns wrote: Hi, I need to convert some numerical values to text using the decimal separator that corresponds to the current locale. However, I do not want to lose information by padding with zero decimals or truncating zero decimals. So I basically want a text ca

Re: [GENERAL] to_char with locale decimal separator

2013-07-29 Thread Ingmar Brouns
On Mon, Jul 29, 2013 at 1:24 PM, Ingmar Brouns wrote: > Hi, > > I need to convert some numerical values to text using the decimal > separator that corresponds to the current locale. However, I do > not want to lose information by padding with zero decimals or > truncating zero decimals. So I basic

[GENERAL] to_char with locale decimal separator

2013-07-29 Thread Ingmar Brouns
Hi, I need to convert some numerical values to text using the decimal separator that corresponds to the current locale. However, I do not want to lose information by padding with zero decimals or truncating zero decimals. So I basically want a text cast that also replaces the dot by a comma. I've

Re: [GENERAL] TO_CHAR(timestamptz,datetimeformat) wrong after DST change

2011-03-18 Thread Jonathan Brinkman
Message- From: Steve Crawford [mailto:scrawf...@pinpointresearch.com] Sent: Friday, March 18, 2011 1:05 PM To: jonathansfl Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] TO_CHAR(timestamptz,datetimeformat) wrong after DST change On 03/18/2011 07:59 AM, jonathansfl wrote: > My TO_

Re: [GENERAL] TO_CHAR(timestamptz,datetimeformat) wrong after DST change

2011-03-18 Thread Steve Crawford
On 03/18/2011 07:59 AM, jonathansfl wrote: My TO_CHAR function is now an hour off thanks to Daylight Savings Time. The dates are correct (I'm in EST: TZ=-04) but my function now returns TIME an hour early. (prior to DST we were TZ=-05). TIMESTAMPTZ data (v_dt): 2011-03-17 18:21:50-04 FUNCTION SN

[GENERAL] TO_CHAR(timestamptz,datetimeformat) wrong after DST change

2011-03-18 Thread jonathansfl
My TO_CHAR function is now an hour off thanks to Daylight Savings Time. The dates are correct (I'm in EST: TZ=-04) but my function now returns TIME an hour early. (prior to DST we were TZ=-05). TIMESTAMPTZ data (v_dt): 2011-03-17 18:21:50-04 FUNCTION SNIPPET: to_char(v_dt, 'mm/dd/ hh:mi AM')

Re: [GENERAL] to_char() Question

2005-12-14 Thread Terry Lee Tucker
Bruno, Thanks for the response. The only problem is that FM removes all the leading spaces. I may have been unclear in stating my problem. I want the padding on the left; however, I don't want the extra space for the sign (+,-) that gets prepended to the string. This output shows what I mean:

Re: [GENERAL] to_char() Question

2005-12-14 Thread Bruno Wolff III
On Tue, Dec 13, 2005 at 11:30:36 -0500, Terry Lee Tucker <[EMAIL PROTECTED]> wrote: > > On Tuesday 13 December 2005 11:20 am, John Sidney-Woollett saith: > > Not sure if there is a numeric formatting option that allows what you want. > > > > But how about? > > > > substr(to_char(1029, '9,999'),2

Re: [GENERAL] to_char() Question

2005-12-13 Thread Terry Lee Tucker
On Tuesday 13 December 2005 11:20 am, John Sidney-Woollett saith: > Not sure if there is a numeric formatting option that allows what you want. > > But how about? > > substr(to_char(1029, '9,999'),2) That's so simple, I'm embarrased ;o) Thanks for the help... > > John > > Terry Lee Tucker said:

Re: [GENERAL] to_char() Question

2005-12-13 Thread John Sidney-Woollett
Not sure if there is a numeric formatting option that allows what you want. But how about? substr(to_char(1029, '9,999'),2) John Terry Lee Tucker said: > Greetings List: > > I am using to_char to format numeric data into a string that is ultimately > displayed in an XmText widget. Much of the

[GENERAL] to_char() Question

2005-12-13 Thread Terry Lee Tucker
Greetings List: I am using to_char to format numeric data into a string that is ultimately displayed in an XmText widget. Much of the numeric data is always going to be positive. In some of the windows that display this data, space is at a premium. Basically, I need to display something like 1,

Re: [GENERAL] to_char bug?

2005-03-04 Thread Ben Trewern
Thanks, sometimes the obvious just passes me by. :-( >If the number is negative there needs to be room for the minus sign... "Martijn van Oosterhout" wrote in message news:[EMAIL PROTECTED] ---(end of broadcast)--- TIP 2: you can get off al

Re: [GENERAL] to_char bug?

2005-03-02 Thread Martijn van Oosterhout
If the number is negative there needs to be room for the minus sign... On Tue, Mar 01, 2005 at 09:25:02AM -, Ben Trewern wrote: > >From the docs: > > "FM suppresses leading zeroes and trailing blanks that would otherwise be > added to make the output of a pattern be fixed-width" > > It work

Re: [GENERAL] to_char bug?

2005-03-01 Thread Ben Trewern
>From the docs: "FM suppresses leading zeroes and trailing blanks that would otherwise be added to make the output of a pattern be fixed-width" It works now but for one I don't understand why the space is added in the firs place and two I think the docs don't tell the whole story ie leading bl

Re: [GENERAL] to_char bug?

2005-02-28 Thread Tom Lane
"Ben Trewern" <[EMAIL PROTECTED]> writes: > It seems that to_char(1, '000') gives a string " 001" with a space in front. > Is this a bug? No. Possibly you want 'FM000'. regards, tom lane ---(end of broadcast)--- TIP 1: sub

Re: [GENERAL] to_char bug?

2005-02-28 Thread Bricklen Anderson
Ben Trewern wrote: Is there any reason why : SELECT char_length(to_char(1, '000')); Gives a result char_length - 4 (1 row) It seems that to_char(1, '000') gives a string " 001" with a space in front. Is this a bug? Regards, Ben Try formatting the result: SELECT char_leng

[GENERAL] to_char bug?

2005-02-28 Thread Ben Trewern
Is there any reason why : SELECT char_length(to_char(1, '000')); Gives a result char_length - 4 (1 row) It seems that to_char(1, '000') gives a string " 001" with a space in front. Is this a bug? Regards, Ben ---(end of broadcast)--

Re: [GENERAL] to_char(interval, text) deprecated in future - how do we get consistent interval output without it?

2005-01-15 Thread Bruno Wolff III
On Fri, Jan 14, 2005 at 11:36:26 -0800, [EMAIL PROTECTED] wrote: > I saw the note in the docs that to_char(interval, text) is deprecated, and > will be removed. I searched the archives and saw more mentions of this, > but no real explanation as to how it is planned for us to get consistent > out

[GENERAL] to_char(interval, text) deprecated in future - how do we get consistent interval output without it?

2005-01-14 Thread SCassidy
I saw the note in the docs that to_char(interval, text) is deprecated, and will be removed. I searched the archives and saw more mentions of this, but no real explanation as to how it is planned for us to get consistent output formatting when querying a column containing interval data. For exampl

Re: [GENERAL] to_char(0,'9999.99') -> ".00"

2005-01-11 Thread Phil Endecott
I asked: >>to_char(0,'.99') >> >>returns .00 rather than 0.00. Dave Smith replied: to_char(0,'9990.00') ? Thanks Dave, that's embarrassingly obvious... I note that the examples in the documentation don't have a 0 before the decimal point, e.g. this one to_char(148.5, 'FM999.990')

Re: [GENERAL] to_char(0,'9999.99') -> ".00"

2005-01-10 Thread Dave Smith
to_char(0,'9990.00') ? On Mon, 2005-01-10 at 22:48 +, Phil Endecott wrote: > Dear All, > > I was a bit surprised to find that > > to_char(0,'.99') > > returns .00 rather than 0.00. > > Is this a bug or a feature? How do I get what I want? > > (This is with 7.4.2. Appolog

[GENERAL] to_char(0,'9999.99') -> ".00"

2005-01-10 Thread Phil Endecott
Dear All, I was a bit surprised to find that to_char(0,'.99') returns .00 rather than 0.00. Is this a bug or a feature? How do I get what I want? (This is with 7.4.2. Appologies if it is a known problem. The search form in the list archives seems to split words on _, so looking for

Re: [GENERAL] to_char problem

2004-06-03 Thread Richard Huxton
On Monday 16 February 2004 19:15, Wei Wang wrote: > I get compile error for this code: > > > for i in 1..arg_count-1 LOOP > RAISE NOTICE quote_literal(to_char(i, ''9'')); > END LOOP; > > where arg_count = 3. > > I tried RAISE NOTICE to_char(i, ''9''); as well. > to_char returns text, right? Then w

Re: [GENERAL] To_char statement problems

2004-04-08 Thread Jim Wilson
Clark Endrizzi said: > I just sent this twice before with the wrong email address so it didn't > go through, that is why I am sending this so that it will get through. > I hope this isn't causing issues. > > Hi guys. I certainly hope this is the correct place to email this. I'm > having an iss

[GENERAL] To_char statement problems

2004-04-08 Thread Clark Endrizzi
I just sent this twice before with the wrong email address so it didn't go through, that is why I am sending this so that it will get through.  I hope this isn't causing issues. Hi guys.  I certainly hope this is the correct place to email this.  I'm having an issue that I have really tried to

Re: [GENERAL] to_char problem

2004-02-17 Thread Richard Huxton
On Tuesday 17 February 2004 12:37, Wei Wang wrote: > In that case, how do I RAISE NOTICE a text variable such as: > DECLARE tempstring text; > BEGIN > RAISE NOTICE tempstring; RAISE NOTICE ''%'',tempstring; Don't forget to double-up (or bacslash-escape) your quotes. -- Richard Huxton Archon

Re: [GENERAL] to_char problem

2004-02-17 Thread Wei Wang
TECTED]> Sent: Monday, February 16, 2004 8:24 PM Subject: Re: [GENERAL] to_char problem > On Monday 16 February 2004 19:15, Wei Wang wrote: > > I get compile error for this code: > > > > > > for i in 1..arg_count-1 LOOP > > RAISE NOTICE quote_literal(to_char(i,

[GENERAL] to_char(now(), 'YYYY') and time zones

2001-04-13 Thread Simon Bæk Carstensen
I'm trying to pull the current year with the following query: select to_char(now(), ''); This is fine. Now, I would like to select this date in different time zones. Normally I just do: select now() at time zone 'utc'; I guess I need a combination of the 2 queries above - one that asks fo

Re: [GENERAL] to_char(date '2001-04-01', 'dd') results in 31 -- why?

2001-01-14 Thread Tom Lane
Fred Yankowski <[EMAIL PROTECTED]> writes: > In PostgreSQL 7.0.3 (on NT), the expression > to_char(date '2001-04-01', 'dd') > evaluates to '31', which is a bit surprising. It's just a bug: date to timestamp conversion did the wrong thing on DST forward transition days in 7.0.3 and before.

[GENERAL] to_char(date '2001-04-01', 'dd') results in 31 -- why?

2001-01-14 Thread Fred Yankowski
In PostgreSQL 7.0.3 (on NT), the expression to_char(date '2001-04-01', 'dd') evaluates to '31', which is a bit surprising. But to_char(timestamp '2001-04-01', 'dd') evaluates to '01' as I would expect. Doing a bit of RTFM, it looks like the various "Date/Time Functions" actua

[GENERAL] to_char

2000-10-19 Thread Yohans Mendoza
Hi again, thanks for all your responses, now that I've taken a better look at my problem, let me rephrase my question I'm moving an app. from oracle to postgres, and I'm having problems with the data type "time" I was able to format oracle's datatype "date" to anything I'd like using to_char func

[GENERAL] to_char function

2000-10-18 Thread Yohans Mendoza
hi all, where can I find info about the function to_char TIA --Yohans ~~~ Yohans Mendoza System Analyst [EMAIL PROTECTED]Sirius Images Inc. http://www.sir