Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdbf2fd2

Browse files
committed
The enclosed patch changes the behaviour of the "ordinal" ('TH') format for
to_char. I don't know about the rest of the world, but the "standard" inAustralia is the following: 1st, 2nd, 3rd, 4th - 9th 10th - 19th 21st, 22nd, 23rd, 24th - 29th (similarly for 30s - 90s) 110th - 119th (and for all "teens") 121st, 122nd, 123rd, 124th - 129thI think you see the trend. The current code works fine except that itproduces: 111st, 112nd, 113rd, 114th - 119th 211st, 212nd, 213rd, 214th - 219th ... and so on.Without knowing anything about what's supported (and what isn't) in the usualI18N libraries, should this type of behaviour be defined within the locales?Daniel Baldoni
1 parentce77462 commitdbf2fd2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎src/backend/utils/adt/formatting.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -----------------------------------------------------------------------
22
* formatting.c
33
*
4-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.10 2000/06/0901:11:08 tgl Exp $
4+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.11 2000/06/0903:18:34 momjian Exp $
55
*
66
*
77
* Portions Copyright (c) 1999-2000, PostgreSQL, Inc
@@ -1258,14 +1258,17 @@ static char *
12581258
get_th(char*num,inttype)
12591259
{
12601260
intlen=strlen(num),
1261-
last;
1261+
last,seclast;
12621262

12631263
last=*(num+ (len-1));
12641264
if (!isdigit((unsignedchar)last))
12651265
elog(ERROR,"get_th: '%s' is not number.",num);
12661266

1267-
/* 11 || 12 */
1268-
if (len==2&& (last=='1'||last=='2')&&*num=='1')
1267+
/*
1268+
* All "teens" (<x>1[0-9]) get 'TH/th',
1269+
* while <x>[02-9][123] still get 'ST/st', 'ND/nd', 'RD/rd', respectively
1270+
*/
1271+
if ((len>1)&& ((seclast=num[len-2])=='1'))
12691272
last=0;
12701273

12711274
switch (last)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp