Hello,
I would like to format my Date output to use two digit years and format the Time output to remove the seconds.
I can't set the DateTime.Dateformat and DateTime.Timeformat variables statically (especially the date) because of localization differences – mm/dd/yyyy vs yyyy/mm/dd ...
In my Activity_Resume I create a global string variable with "yyyy" replaced by "yy". I display the original dateformat and my new variable in a Log statement. Everything looks good.
DateFormat MM/dd/yyyy
MyDatFmt MM/d/yy
TimeFormat HH:mm:ss
MyTimFmt HH:mm
Later in my code in response to a button click I set dateformat to my variable.
As soon as I put in that line of code, dateformat in my Activity_Resume Log statement changes to the empty string. (Note this happens long before my statement in the button click is actually executed).
DateFormat
MyDatFmt
TimeFormat
MyTimFmt
If instead in my button click, I change dateformat statically to the string "mm/dd/yy" all is fine and my Activity_Resume Log statement reflects the new dateformat value – even before the static assignment is executed in the button click.
It looks like something is intercepting the fact that I may want to change the dateformat at some point and making the change very early in my apps execution. If I eventually set dateformat to a variable, early in my apps execution the variable is empty so dateformat becomes empty. If I eventually set dateformat to a static string, "mm/dd/yy", it is set to this early in my programs execution and that value is reflected in the Activity_Resume Log statement.
Could this be true?
In Delphi there is a statement: FormatDateTime. This allows you to provide a format string and a DateTime value. It produces string output according to the format string. Is there something like this in B4A? How do I custom format DateTime output?
Thanks,
Barry.
I would like to format my Date output to use two digit years and format the Time output to remove the seconds.
I can't set the DateTime.Dateformat and DateTime.Timeformat variables statically (especially the date) because of localization differences – mm/dd/yyyy vs yyyy/mm/dd ...
In my Activity_Resume I create a global string variable with "yyyy" replaced by "yy". I display the original dateformat and my new variable in a Log statement. Everything looks good.
DateFormat MM/dd/yyyy
MyDatFmt MM/d/yy
TimeFormat HH:mm:ss
MyTimFmt HH:mm
Later in my code in response to a button click I set dateformat to my variable.
As soon as I put in that line of code, dateformat in my Activity_Resume Log statement changes to the empty string. (Note this happens long before my statement in the button click is actually executed).
DateFormat
MyDatFmt
TimeFormat
MyTimFmt
If instead in my button click, I change dateformat statically to the string "mm/dd/yy" all is fine and my Activity_Resume Log statement reflects the new dateformat value – even before the static assignment is executed in the button click.
It looks like something is intercepting the fact that I may want to change the dateformat at some point and making the change very early in my apps execution. If I eventually set dateformat to a variable, early in my apps execution the variable is empty so dateformat becomes empty. If I eventually set dateformat to a static string, "mm/dd/yy", it is set to this early in my programs execution and that value is reflected in the Activity_Resume Log statement.
Could this be true?
In Delphi there is a statement: FormatDateTime. This allows you to provide a format string and a DateTime value. It produces string output according to the format string. Is there something like this in B4A? How do I custom format DateTime output?
Thanks,
Barry.