locked
MVC date formats - En-GB format RRS feed

  • Question

  • User502787105 posted

    I'm in the uk and when I go to add dates to a form using the model the dates are american format - can someone tell me the correct way to make the culutr en-gb - I tried adding this:-

    <globalization uiCulture="en" culture="en-GB" />

    I added that line above the web.config but it made no difference.

    Thanks
    Gregor

    Saturday, May 29, 2010 2:06 PM

Answers

  • User502787105 posted

    Apologies - the reason the dates were invalid is because they actually were invalid - the jqueryUI script i was using wasnt using the EN-gb version and hence kept formatting the date to US version - I added the Uk version and it works now.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 1, 2010 2:42 AM

All replies

  • User197322208 posted

    It should make .

    How do you display the dates ? OR ... where do you find the problem ?


    Saturday, May 29, 2010 4:57 PM
  • User1064071399 posted

    I'm not familar with the way you do it in the web.config

    What I do however where I need to display amounts in different culture's no matter the user's current settings is this:

    123.456 ("C", en-US) -> $123.46
    
    123.456 ("C", fr-FR) -> 123,46 €
    
    123.456 ("C", ja-JP) -> ¥123



    Sunday, May 30, 2010 1:00 AM
  • User401360897 posted

    Put a Break Point and see the value of Thread.CurrentThread.CurrentUICulture in quick watch window or immediate window. 

    Sunday, May 30, 2010 2:17 AM
  • User502787105 posted

    Ok I have 2 dates which are required, start_date and end_date. The form loads with todays date populated in the start_date field fore example 31/05/2010 which is great - If I cut this value and paste it into the end_date it works just fine, however if I dont put a value into the end_date the validation firews and says "The value '05/31/2010' is not valid for Start Date" in the validation error text.

    To recap its fine putting in 31/05/2010 unless the validation fires and then it will say its invalid and display the error in the US fomat.

    Any ideas on how to fix that?

    Thanks
    Gregor

    Monday, May 31, 2010 4:21 AM
  • User-1200560727 posted

    I think you will get the solution from this post: http://forums.asp.net/t/1514920.aspx



    Monday, May 31, 2010 5:05 AM
  • User502787105 posted

    Any other ideas - surely I dont need to have a baspage in MVC as well - uuugh! 

    Monday, May 31, 2010 3:01 PM
  • User401360897 posted

    Can you more explain this situation

    Ok I have 2 dates which are required, start_date and end_date. The form loads with todays date populated in the start_date field fore example 31/05/2010 which is great - If I cut this value and paste it into the end_date it works just fine, however if I dont put a value into the end_date the validation firews and says "The value '05/31/2010' is not valid for Start Date" in the validation error text
     

    Monday, May 31, 2010 10:29 PM
  • User502787105 posted

    Apologies - the reason the dates were invalid is because they actually were invalid - the jqueryUI script i was using wasnt using the EN-gb version and hence kept formatting the date to US version - I added the Uk version and it works now.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 1, 2010 2:42 AM