Android Question TimeFormat Global?

Discussion in 'Android Questions' started by alan dodd, Jun 2, 2015.

  1. alan dodd

    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.
     
  2. DonManfred

    DonManfred Expert 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
    Code:
    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.
     
  3. alan dodd

    alan dodd Member Licensed User

    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.
     
  4. klaus

    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.
     
    lemonisdead likes this.
Loading...