Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DateTime format on hosting server

I recently switched my hosting provider and due to the time zone that the server is now in, my code has stopped working.

The hosting server reports in Pacific time, However, my code needs to work with GMT as my site is for the UK market. So, all my displays and searches need to be in the format dd/MM/yyyy

How can I account for the difference?

For instance, when I do a DateTime.Parse("03/11/2008") it fail as I assume the 'Parse' is against the servers settings. I also get "String was not recognized as a valid DateTime." throughout my code.

like image 693
Skittles Avatar asked Dec 18 '22 10:12

Skittles


1 Answers

In your web.config file add <globalization> element under <system.web> node:

<system.web>
  <globalization culture="en-gb"/>
  <!-- ... -->
</system.web>
like image 189
Pavel Chuchuva Avatar answered Dec 24 '22 00:12

Pavel Chuchuva