Android Question TimeFormat Global?

Similar threads

B4A Code Snippet TakeTime
B4A Code Snippet Application Log File Function
B4A Code Snippet Convert timestamp date to Brasil format
B4A Tutorial [B4X] Smart String Literal
B4A Question TimeFormat locale
B4A Question Unparseable date

alan dodd

Member
Licensed User
Hello everybody.
Maybe an already answered question:

If first app executes this:

DateTime.TimeFormat = "HH:mm"
DateTime.DateFormat = "yyyy-MM-dd"

Do these new formats become global for the phone, I mean if I start another new app, does it use the new settings?
And if I close the app that originated the new format, does the format remain changed?
Thank you
A.
 

DonManfred

Expert
Licensed User
Do these new formats become global for the phone
No as you dont change a global setting. Only the USER (deviceowner) can change the default date time formats. Most probably when setting the language.

The setting is just for your app. As long as the apps process is running the setting will be active.
You can set it back to the default values if you want...

If you want to set it back to the defaults use
B4X:
    DateTime.DateFormat =    DateTime.DeviceDefaultDateFormat
  DateTime.TimeFormat = DateTime.DeviceDefaultTimeFormat

But it is a setting only for your app while it runs. If you quit your app the setting will be the device-default for all other apps.
 

alan dodd

Member
Licensed User
No as you dont change a global setting. Only the USER (deviceowner) can change the default date time formats. Most probably when setting the language.

The setting is just for your app. As long as the apps process is running the setting will be active.
You can set it back to the default values if you want...

If you want to set it back to the defaults use
B4X:
    DateTime.DateFormat =    DateTime.DeviceDefaultDateFormat
  DateTime.TimeFormat = DateTime.DeviceDefaultTimeFormat

But it is a setting only for your app while it runs. If you quit your app the setting will be the device-default for all other apps.
So - just to be sure I understand it right - I may have two different apps running at the same time on the same phone, each one of them having different time and date format settings. Is this correct?

Thank you for the quick answer, have a good day.
A.
 

klaus

Expert
Licensed User
Yes !
You can set different settings even in your own application.
I have used this in a progran where I needed a specific format.
I saved the current format, changed it for my needs and set it back to the original.
 
Top