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

Wrong format

3 Answers 695 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Serkan
Top achievements
Rank 1
Serkan asked on 08 Jun 2012, 07:59 AM
Although i set the culture to germany [ kendo.culture("de-DE") ] the format of the datetime is not correct, it is still default "en-US".
I have to set additionally the format like this

[Javascript]
jQuery(function(){jQuery("\#start").kendoDateTimePicker({format:kendo.culture().calendar.patterns.g,min:new Date(1899,11,31,0,0,0,0),max:new Date(2100,0,1,0,0,0,0),interval:30});});

or this

[Razor]
@(Html.Kendo().DateTimePicker()
            .Name("start")
            .Format("dd.MM.yyyy HH:mm")
            .Value(DateTime.Now)
             
    )


The format/values of date and time in both dropdowns of the datetimepicker are correct, only the format in the input field is wrong.


But the format of time-values in the dropdownlist of a normal timepicker is not correct too,  it is not like the format of the current culture, it is still default "en-US" but without "AM" & "PM".

List of format failure:
Culture set to "de-DE"

DateTimePicker:
 format of values (date&time) in the inputfield: wrong
 format of date in dropdown: correct
 format of time in dropdown: correct

TimePicker:
 format of values in the inputfield: wrong
 format of time in dropdown: wrong

DatePicker:
 format of values in the inputfield: wrong
 format of date in dropdown: correct

3 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 11 Jun 2012, 10:05 AM
Hi Serkan,

 
Setting the culture info with kendo.culture("de-DE") does not change the culture on the server. Here is a simple Razor view, which shows how to achieve your goal:

@section HeadContent {
    <script src="@Url.Content("~/Scripts/cultures/kendo.culture.de-DE.js")"></script>
}
 
<script type="text/javascript">
    //set culture of the Kendo UI
    kendo.culture("de-DE");
</script>
 
@{
    Culture = "de-DE";
}
 
@(Html.Kendo().DateTimePicker()
      .Name("datetimepicker")
      .Value(DateTime.Now)
)


Regards,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Chanaka
Top achievements
Rank 2
answered on 30 Aug 2012, 06:28 AM
It is a Simple  Answer No need to specify the culture  Use parameterMap and column format

parameterMap: function (options, operation) {
                            if (operation != "read") {
                                var d = new Date(options.Date);
                                options.Date = d.toString("yyyy-MM-dd");                            
                                return options;
                            }
                        }

{ field: "Date", title: "Date ", type: "date", format: "{0:dd/MM/yyyy}" }

result : 30/08/2012

Hope this will help all of you all  
0
Serkan
Top achievements
Rank 1
answered on 30 Aug 2012, 06:48 AM
hey @all,

first, I must thank you for your answers!

@Georgi: The server culture was already set like you said and I donĀ“t know why, but the problem was solved after reinstalling the razor engine and the .net 4 framework (reason: some other different problems)... anyway Thanks

@Chanaka: I would prefer to use the culture settings first, because of maintenance issue if you have to define a lot of paramaterMaps for all localizations, but I will use your hint to program special wishes of customers which are not solvable with the normal culture settings, so I thank you.

Nice regards
Serkan M.
Tags
Date/Time Pickers
Asked by
Serkan
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Chanaka
Top achievements
Rank 2
Serkan
Top achievements
Rank 1
Share this question
or