3

I have been put on fixing a VB.net app and now I am trying to set the date format to something that makes sense like dd-MM-yyyy or yyyy-MM-dd, anything that doesn't have the dates in a weird american order really.

So I have this row in my aspx file:

<asp:TextBox ID="txtDateFrom" type="date" runat="server"></asp:TextBox>

I tried setting globalization:

<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-AU" uiCulture="en-AU" />

in Web.config but it didn't make a difference, is there anyway I can force it to use a special date format in the TextBoxes? Right now it displays differently in chrome and firefox.

Chrome:

Chrome textbox

Firefox:

Firefox textbox

spydon
  • 9,372
  • 6
  • 33
  • 63
  • 2
    See http://stackoverflow.com/a/9519493/1127114 – Michael Liu Oct 25 '13 at 02:26
  • Thank you, so in this case this is a Chrome "problem" and not anything I can possibly fix with code, right? – spydon Oct 25 '13 at 02:39
  • Unfortunately, that seems to be the case. You might want to consider using the [jQuery UI Datepicker plugin](http://jqueryui.com/datepicker/), which allows greater control over formatting. – Michael Liu Oct 25 '13 at 14:35
  • jQuery Datepicker is not operable by keyboard, and thus fails Accessibility requirements. If that matters to you. It does for my company, which is why I'm trying to replace it. I'm having the same issue as OP; Chrome insists on using local machine date format no matter what. – Andrew S Sep 18 '18 at 19:27

1 Answers1

2

Short answer derived from one of the commenters, for all you googlers showing up here.

While the date has to be transferred in the yyyy-mm-dd format, the presentation may be whatever the browser chooses. In this case chrome implements an un-desired presentation behaviour, for your case.

nyaray
  • 508
  • 4
  • 11