Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date formats in c#
Message
De
09/02/2012 12:46:21
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01534833
Message ID:
01535014
Vues:
55
I think Viv mentioned TryParseExact
using System.Globalization;



	DateTime dt;
	if (DateTime.TryParseExact("20100510", "yyyyMMdd", null, DateTimeStyles.None, out dt))
	{
		Console.WriteLine(" {0}", dt);
	}
	else
	{
		Console.WriteLine(" no match");
	}
	Console.ReadLine();
>Many thanks for all replies.
>Still am not sure of the answer though, without wading through tons and tons of stuff.
>
>Is there any .net equivalnet ( ={^2011-05-10} ) that will A-L-W-A-Y-S return correct date, irrespective of the local
>Seems to be a divergence of opinion in the answers , or am I picking them up wrong ?
>
>Regards,
>Gerard
>
>
>>Look at this article to see if it helps
>>
>>http://msdn.microsoft.com/en-us/library/ms973825.aspx
>>
>>
>>>Hi.
>>>
>>>VFP
>>>x={^2011-05-10} ALWAYS returns 10th May 2011 no matter what the culture is
>>>
>>>C#
>>>dateValue = DateTime.Parse("2011-05-10");
>>> Does this ALWAYS return 10th May, 2011 or are there instances when I could get 5th October 2011 ?
>>> If so, can it be made unambiguous , similar to the ^ in VFP
>>>Tia
>>>Gerard
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform