Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

450
Visualizações
Unity - How to get date format of device on Android?

I'm trying to get the date format of the device in my game. I changed my date format to month/day/year in the device's settings and the code down below gave me "MM/dd/yyyy" in the log. Then I changed my date format to day/month/year but still the log was "MM/dd/yyyy".

How can I get the date format in Android?

I'm using a class in the System.Globalization library

Debug.Log(DateTimeFormatInfo.CurrentInfo.ShortDatePattern)

I also tried to restart the device after changing the date format in the settings, but it didn't work.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

DateTimeFormatInfo.CurrentInfo.ShortDatePattern are just format string.

Try

 Debug.Log(System.DateTime.Now.ToString(DateTimeFormatInfo.CurrentInfo.ShortDatePattern));
over 4 years ago · Santiago Trujillo Relatório

0

Maybe try.

String DateString = system.datetime.now.tostring;

String[] BreakUp1 = DateString.split(',');

String[] BreakUp2 = BreakUp1.split('/');

String newDate = BreakUp[1] + "/" + BreakUp[0] + "/" + BreakUp[2];

This will create dd/mm/yyyy if the format is originally coming out mm/dd/yyyy.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda