Android Question TimeFormat Global?

alan dodd

Member
Licensed User
Longtime 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
Longtime 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.
 
Upvote 0

alan dodd

Member
Licensed User
Longtime 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.
 
Upvote 0

klaus

Expert
Licensed User
Longtime 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.
 
Upvote 0
Top