This is a migrated thread and some comments may be shown as answers.

Wrong date displayed

3 Answers 123 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Gilbert van Veen
Top achievements
Rank 1
Gilbert van Veen asked on 04 Nov 2009, 09:31 AM
Hi,

First I want to explain that I totally new to the Telerik products. After a test with the trial version we have decided to buy (now two days ago) we bought the whole Telerik suite. So, this question may sounds silly.

In the MySql table I have a DATA field which containts 02-09-2009 (Dutch format for the second of september 2009). In my telerik grid this data is shown as 01-09-2009? The same happens for the datepicker on a childform. For some reason the date format does a strange thing.

Should I set the display format for the column and or the datepicker and how should I do it?

Thanks in advance,

Please note my XAML file for the grid there is already the following:

<

 

telerik:GridViewDataColumn DataMemberBinding="{Binding BirthDate}" DataFormatString="{}{0:dd/MM/yyyy}"></telerik:GridViewDataColumn>

 

 


This is the correct Dutch format but still it shows the wrong date on the screen.

3 Answers, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 06 Nov 2009, 04:29 PM
Hi Gilbert,

I tried to replicate your scenario, but everything works as expected. Can you send us a small sample project that illustrates your case exactly so we can verify it locally?

Sincerely yours,
Stefan Dobrev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
uku
Top achievements
Rank 1
answered on 11 Nov 2009, 01:47 PM
Hello Stefan,

I'm also interested in this subject. I have the same problem with German date format which is 02.09.2009 for the second of september. I guess it's not a Telerik datepicker problem because I had the same issue with the datepicker of the Microsoft toolkit. I think it has something to do with culture settings.

I'm working on an English vista, with an English Visual Studio, an English IE8 and with an English SQL Server, but my formats and location settings in vista are German (Germany).
I thought it could be a problem with database settings, because when selecting the date in the datepicker it seems ok but it was written wrong to the database but if Gilbert has the same issue with his MySQL table than this is probably the wrong path to follow.

By the way I'm using the DateTime data type for the column in SQL Server and not one of the new data types.

I hope you will find a solution to this problem even if it might be not a Telerik specific problem. I think it would be a great idea for a blog entry about internationalization. Not just using different languages but also what needs to be considered if an app should be hosted for customers in different countries, which means different OS and browser languages different format and culture settings.

Bye

Uwe
0
Gilbert van Veen
Top achievements
Rank 1
answered on 04 Mar 2010, 01:46 PM
I think the problem has to due with the fact that the DateTime value in the MSSQL table is not filled with a complete DateTime value. In my case I only store the Date and the time is set to null. This is done because I don't need the time.

When I changed my code and instead of the null value for the time, I add a fixed time 23:59:59 then every component (Grid and DateTime picker) are shown the correct date values.

I don't know if this is logic or that it needs a little change to the Telerik components to "catch" these cases? Nevertheless I solved it for now.

So now I store the date like this: 01-03-2010 23:59:59

Case closed :)
Tags
DatePicker
Asked by
Gilbert van Veen
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
uku
Top achievements
Rank 1
Gilbert van Veen
Top achievements
Rank 1
Share this question
or