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

191
Visualizações
Datetime parse "2021-04-20T00:09:14.7724640+02:00"

Best way to parse time = "2021-04-20T00:09:14.7724640+02:00" to valid time. I need seconds as well however once

var h = DateTime.ParseExact(time.Substring(14,5), "hh:mm", CultureInfo.InvariantCulture);

this returns only hour and minute but I need seconds too, however there is 09:14.7724640+02:00 and if I tried hh:mm:ss the "." throws an "Invalid DateTimet "exception

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

0

string time = "2021-04-20T00:09:14.7724640+02:00";
DateTime dateTime = DateTime.Parse(time);

With this you have the whole string in the DateTime object and can do whatever you want with it (e.g. cut out hours, minutes and seconds).

over 4 years ago · Santiago Trujillo Relatório

0

You are looking for a timespan, datetime also contains a date part.

If you use the following code you will get a DateTime an a TimeSpan

var timeString = "2021-04-20T00:09:14.7724640+02:00";
var dateTime = DateTime.Parse(timeString);
var time = dateTime.TimeOfDay;
Console.WriteLine(time);
over 4 years ago · Santiago Trujillo Relatório

0

you can use ToString("dd MMMM, yyyy") and give it the format that you want

public static string GetDate(DateTime date)
        {
            return date.ToString("dd MMMM, 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