Ejemplo: Excepción lanzada: ‘System.FormatException’ en las fechas de mscorlib.dll
/* Just putting this here for myself, but maybe it will help someone else too:
If this error occurs when you are importing data from Excel,
it is possible that your computer's regional settings are incorrect.
Try using ExactParse if in C# , and if there are still issues it may be the
Excel/ regional setting combo causing the issue.
*/
try
{
formattedDate = DateTime.ParseExact(dateString, "dd/MM/yyyy", null).ToString("yyyy-MM-dd");
}
catch
{
// Might be the wrong expected format, might be regional settings
}
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)