Am Samstag, den 29.08.2015, 11:55 +0200 schrieb Benoît Minisini: > Le 29/08/2015 11:08, Charlie Reinl a écrit : > > Am Samstag, den 29.08.2015, 04:22 +0300 schrieb Jussi Lahtinen: > >>> correct me if I go wrong, I still don't see for what we need the > >>> localization. > >>> Having a Date or Date/Time and we want to format it, where we need > >>> localisation there for. > >>> > >>> Using german date is Format(now(),"dd.mm.yyyy") but I also can write > >>> Format(now(),"mm/dd/yyyy") or Format(now(),"dd-mm-yyyy") but also > >>> Format(now(),"dd;mm;yyyy") yes that should work (it's a ';' not a ':') > >>> Please enlighten me, I can't see the usage of localization in that > >>> converting. > >>> > >> > >> How I supposed to verify output of Format(now(),"mm/dd/yyyy") ? > >> Correct result can be 08.29.2015 or 08/29/2015 depending on the > >> localization (or even something completely different). > >> > >> > >> Jussi > > > > Salut Jussi, > > > > attached you a quick hack who shows that the Format don't > > use the localization. > > > > For the last time, Format$() *does* use the localization settings, as > explicitly stated in the documentation. > > But it uses them for its special formatting characters only. Non-special > characters are just inserted as is in the resulting string. > > If you want to write translatable date/time code, you have to use > pre-defined date formats (gb.GeneralDate and ). > > If none of the pre-defined formats fit your needs, then you have to > create your own by: > > 1) Determining the order of date and time components by analysing the > formatting of a cleverly chosen date with gb.ShortDate and gb.ShortTime. > See the source code of DateChooser control for the details. > > 2) Using the "/" and ":" formatting characters in the format string. > > Regards, >
Ok, understood. Both Format$() and Format() use it Debug sLangu;; "Now()="; Now();; "Format$="; Format$(Now(), "dd/mm/yyyy hh:nn:ss.uu");; " Format="; Format(Now(), "dd/mm/yyyy hh:nn:ss.uu") MMain.Main.19: en_CA.UTF-8 Now()=2015-08-29 15:38:55 Format$=29-08-2015 15:38:55.457 Format=29-08-2015 15:38:55.457 ------------------------------------ Debug sLangu; gb.NewLine & gb.Tab; "Now()="; Now(); gb.NewLine & gb.Tab; "Format$="; Format$(Now(), "dd/mm/yyyy hh:nn:ss.uu"); gb.NewLine & gb.Tab; " Format="; Format(Now(), "dd/mm/yyyy hh:nn:ss.uu") MMain.Main.20: en_CA.UTF-8 Now()=2015-08-29 15:38:55 Format$=29-08-2015 15:38:55.457 Format=29-08-2015 15:38:55.457 -- Amicalement Charlie ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user