Click here to Skip to main content
15,896,479 members
Home / Discussions / C#
   

C#

 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 1:03
Support1239-Nov-06 1:03 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
rah_sin9-Nov-06 1:33
professionalrah_sin9-Nov-06 1:33 
AnswerRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Colin Angus Mackay9-Nov-06 1:00
Colin Angus Mackay9-Nov-06 1:00 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 1:09
Support1239-Nov-06 1:09 
AnswerRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Hunuman9-Nov-06 1:29
Hunuman9-Nov-06 1:29 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 1:44
Support1239-Nov-06 1:44 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Colin Angus Mackay9-Nov-06 6:59
Colin Angus Mackay9-Nov-06 6:59 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Pete O'Hanlon9-Nov-06 1:45
mvePete O'Hanlon9-Nov-06 1:45 
Naruto

You've asked the same question several times. I think you need to provide a little bit more information before we can help you.

Here's a few things to answer/think about:

What type of application is this? Is it WinForms or ASP.NET?
How are you attempting to print out the date? Have you printed out the DateTime.ToLongTimeString() to see if the time is there. BTW - you can't have a value of 14:00:00 PM;)

As I stated in an earlier answer to you, I suspect that your problem is the CurrentCulture. If you are using ASP.NET, then it is entirely possible that the problem is because the culture of the user that ASP.NET runs under is different to yours. To solve this, you can use a "clever" trick to sort this out.

In your Page_Load method, call the following routine:

public static void SetCulture(HttpRequest req)<br />
{<br />
  if (req != null && req.UserLanguages != null && req.UserLanguages.Length > 0)<br />
  {<br />
    SetCulture((string)req.UserLanguages[0]);<br />
  }<br />
}<br />
<br />
public static void SetCulture(string culture)<br />
{<br />
  CultureInfo ci = new CultureInfo(culture);<br />
  Thread.CurrentThread.CurrentCulture = ci;<br />
  Thread.CurrentThread.CurrentUICulture = ci;<br />
}

If you call the first method, the user will get data presented to them in the culture that they have set up on their machine. So, somebody from France would probably get information back for the culture fr-FR. Now, calling the second method means that you can specify the culture explicitly, and the user will get information back in that culture, so the same French user would get back information with GB settings if you called SetCulture("en-GB");

Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."

Deja View - the feeling that you've seen this post before.

GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 2:12
Support1239-Nov-06 2:12 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Pete O'Hanlon9-Nov-06 2:27
mvePete O'Hanlon9-Nov-06 2:27 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 2:32
Support1239-Nov-06 2:32 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Pete O'Hanlon9-Nov-06 4:14
mvePete O'Hanlon9-Nov-06 4:14 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 5:27
Support1239-Nov-06 5:27 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Pete O'Hanlon9-Nov-06 9:11
mvePete O'Hanlon9-Nov-06 9:11 
QuestionTo make possible to manage position and size of controls by mouse Pin
wasek20018-Nov-06 23:59
wasek20018-Nov-06 23:59 
AnswerRe: To make possible to manage position and size of controls by mouse Pin
mark_w_9-Nov-06 0:27
mark_w_9-Nov-06 0:27 
QuestionRe: To make possible to manage position and size of controls by mouse Pin
wasek20019-Nov-06 4:31
wasek20019-Nov-06 4:31 
QuestionAbstract collection in property grid Pin
mark_w_8-Nov-06 23:56
mark_w_8-Nov-06 23:56 
AnswerRe: Abstract collection in property grid Pin
Robert Rohde9-Nov-06 0:52
Robert Rohde9-Nov-06 0:52 
AnswerRe: Abstract collection in property grid Pin
mark_w_9-Nov-06 1:27
mark_w_9-Nov-06 1:27 
QuestionWrapping or creating custom XML elements Pin
TUX2K8-Nov-06 23:39
TUX2K8-Nov-06 23:39 
QuestionLike "VS Watch" control Pin
El'Cachubrey8-Nov-06 23:38
El'Cachubrey8-Nov-06 23:38 
Questionhow to select data from the datagrid Pin
Saira Tanwir8-Nov-06 23:22
Saira Tanwir8-Nov-06 23:22 
AnswerRe: how to select data from the datagrid Pin
rah_sin8-Nov-06 23:45
professionalrah_sin8-Nov-06 23:45 
GeneralRe: how to select data from the datagrid Pin
Saira Tanwir9-Nov-06 0:00
Saira Tanwir9-Nov-06 0:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.