Domanda

Right now this string is returning: "Giovedi 24 Ottobre 2013", which is absolutely correct. I have adjust the result with a +1 hour for my specific needs. I need the string to return "Thursday 24 October 2013", basically the same but in English.

 private string Datetime()

{
    DateTime dt = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);

    return dt.AddHours(1).ToLongDateString();
}

How can I change the method to return the date in English?

È stato utile?

Soluzione 2

You don't really need to use the TimeZoneInfo class to do this...

return DateTime.UtcNow.ToString("D", new CultureInfo("en-US"))

Altri suggerimenti

Try this:

return dt.AddHours(1).ToString("D", new CultureInfo("en-US"));
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top