Click here to Skip to main content
15,846,727 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I am stuck in some date formating.

I am having some string which I have to convert into date object with format (yyyy-MM-dd), irrespective of my machine date culture(because I want to pass that date to some webservice which accept date only in(yyyy-MM-dd) format)
Posted
Updated 10-Jan-11 5:32am
v3
Comments
Dalek Dave 10-Jan-11 10:32am    
Minor Edit for Grammar.

Take a look at this:
Custom Date and Time Format Strings[^]

Regards
Espen Harlinn
 
Share this answer
 
Comments
Dalek Dave 10-Jan-11 10:32am    
Good Link.
Espen Harlinn 10-Jan-11 10:37am    
Thanks Dalek!
If you have a string, then you basically need to reformat that string to fit your required format. The DateTime object itself does not have a format associated with it. It's not internally stored as a string. Perhaps you mean that you have a DateTime object and you want to extract a specific string format from that. If so, that's possible. Just use an appropriate ToString overload.
 
Share this answer
 
Check out below article

String Format for DateTime [C#]


Accept the answer if find useful :)
 
Share this answer
 
v2
Comments
Espen Harlinn 10-Jan-11 10:14am    
5+ good link too
Sandesh M Patil 10-Jan-11 10:15am    
I didnot get my 5 buddy
Dalek Dave 10-Jan-11 10:33am    
I gave you a 5.
I think Mr Harlinn forgot! :)
Sandesh M Patil 10-Jan-11 10:35am    
Thanks DD :)
Espen Harlinn 10-Jan-11 10:38am    
Now you've get'em :)
Most software can output date time as the UTC format which is what you want. Ask the people providing you the date to format it correctly.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900