[Gambas-bugtracker] Bug #1969: result of function Format () is error

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Sat Nov 21 01:37:19 CET 2020


http://gambaswiki.org/bugtracker/edit?object=BUG.1969&from=L21haW4-

Comment #20 by Benoît MINISINI:

1) If you want the numerical values of dates components only, with no separators, you have to use Year(), Month(), Day(), Hour()... functions, and not directly Format().

2) If you use "/" in a format string, it will be replaced by the Chinese separator, according to the date component format just before. For example, "dd/" will generate a day separator, "yyyy/" a year separator, and so on.

3) If you don't specify "/" at the end of a date component format, it will be printed anymore, as specified by the full Chinese date format provided by the system library.

4) If you actually want a "/" separator, and not the Chinese one, you have to quote him with a backslash "\". See the wiki documentation about Format$() and format strings.

5) Repeat 2) 3) and 4) for time formats.

6) The month formatting returned by "mmm" ("1月"...) directly comes from the C system library. I will see if I can fix them, but there is very little chance.

7) Same remark for "ddd" and "dddd".

Anyway I will try to fix Format() so that it will generate date separators only if at least one "/" is used, and time separators only if at least one ":" is used. Otherwise they won't be generated.

That way Format$(date, "yyyy") will return "2020", and Format$("yyyy-mm-dd") will return "2020-11-21". But Format$("yyyy/mm-dd") will return "2020年11月-21日".

I will tell you more when it is done.

Benoît MINISINI changed the state of the bug to: Working.




More information about the Bugtracker mailing list