locked
Now() showing US date format when GB required RRS feed

  • Question

  • User-2054902862 posted

    I have a page which inserts values into a database. The database is set up with UK date format - for today (Feb 14th) will accept 14/02/07 and not 02/14/07.

    The code selects the date using the now() function but this is reading todays date as 14/02/07 and so this is failing on the insert.

    I have added

    UICulture="EN" Culture="EN-GB" to the page

    I have also added

    <globalization culture="en-GB" /> to the web.config file

    What else can I do before inserting Now() to change it into dd/mm/yyyy format?

    Thanks

    Clare

    Wednesday, February 14, 2007 8:14 AM

All replies

  • User1178851682 posted

    Hi

    the simple way is

    DateTime.Now().ToString("dd/MM/yyyy");

    Wednesday, February 14, 2007 8:26 AM