How to set Date and time format in IIS 7

2019-01-11 03:30发布

I have date format in my local machine : (d/M/yyyy h:mm tt) ==> (23/6/2011 4:30 PM)

when i publish my website on IIS server it converts date format to (M/d/yyyy H:mm)

i changed the date and time formats of the server but it's not affected . i changed the culture of the website to English US time format solved but date not. (M/d/yyyy hh:mm tt) i changed the culture of the website to English UK date format solved but time not. (d/MM/yyyy H:mm)

what is the solution to make it's format like my local format ???!!!

标签: iis-7
8条回答
Ridiculous、
2楼-- · 2019-01-11 03:38

Even after setting application locale it was still picking up the application pool users locale. I had to change the region settings for all users. This screen shot might help...

  1. Change System Locale
  2. Change Region Settings to desired

Change System Locale

查看更多
做自己的国王
3楼-- · 2019-01-11 03:44

I was having the same problem, I just found a solution, you need to change the key on the server, follow this steps:

  • Go into Registry Editor (start -> run -> type regedit).
  • Get into the folder HKEY_USERS -> .DEFAULT -> Control Panel -> International.
  • Look for the key sShortDate, right click -> Modify...
  • Change the Value data for d/M/yyyy.
  • Log off. Then next time you log in, dates should be work as you wanted.

That should do the trick, you can also change the sLongDate.

查看更多
叛逆
4楼-- · 2019-01-11 03:49

This is based on Nedim answer, but with tweak:

  • Go to Control Panel
  • Click Region and you will see a screen with 3 tabs (Formats, Location and Administrative)
  • Click Formats and choose the settings you prefer
  • Click Additional settings
  • Click Date tab
  • Change Short date to desired format and confirm dialog
  • Click Location and choose the settings you prefer
  • Click Administrative tab. For "Welcome screen and new user accounts", click copy settings. From the new window, click both checkboxes for 'welcome screen and system accounts' and 'new user accounts' (if you skip this step, you will still see the issue because IIS uses system account)
  • Approve all changes for Region by clicking Ok on all open windows
  • Open Command prompt, write iisreset and enter
  • If you still don't see the changes try logoff and logon

In my case the default format for my country was wrong and I couldn't pick proper format except choosing someting else with desired format. But there was web.config with globalization set to my local culture which had precedense.

查看更多
爷、活的狠高调
5楼-- · 2019-01-11 03:50

Please try the below steps.Its works for me

  1. Check app pool of your application in IIS.
  2. Go to Application pool of your website and change Identity of that pool to local service(because your desired date format you have set is in your local system) in Advance setttings.
  3. Restart your app in IIS
查看更多
疯言疯语
6楼-- · 2019-01-11 03:57
  • Go to Control Panel
  • Click Region and you will see a screen with 3 tabs (Formats, Location and Administrative)
  • Click Formats and choose the settings you prefer
  • Click Location and choose the settings you prefer
  • Click Administrative tab. For "Welcome screen and new user accounts", click copy settings. From the new window, click both checkboxes for 'welcome screen and system accounts' and 'new user accounts' (if you skip this step, you will still see the issue because IIS uses system account)
  • Approve all changes for Region by clicking Ok on all open windows
  • Open Command prompt, write iisreset and enter
  • If you still don't see the changes try logoff and logon
查看更多
仙女界的扛把子
7楼-- · 2019-01-11 03:58
- Open IIS 7
- Select your website
- Open .NET GLOBALIZATION
- From Culture tab, select required Culture and UI Culture.
- Do iisreset
查看更多
登录 后发表回答