jump to navigation

How to set Date and time format in IIS 7 (Date time format issue in ASP.NET Web Application) Thu - Jan 9, 2014

Posted by supriyatna in .NET, All, Windows.
trackback

Berikut adalah error yang muncul pada ASP.NET web application, jelas terdeskripsikan bahwa error terjadi pada saat proses konversi date time.

String was not recognized as a valid DateTime. Details...

Detail Error

System.FormatExceptionString was not recognized as a valid DateTime.

System.FormatException: String was not recognized as a valid DateTime.
  at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
  at System.Convert.ToDateTime(String value, IFormatProvider provider)
  at System.String.System.IConvertible.ToDateTime(IFormatProvider provider)
  at System.Convert.ToDateTime(Object value)

Solusinya?, seperti yang dijelaskan pada link referensi dibawah:

  • Open IIS 7
  • Select your website
  • Open .NET GLOBALIZATION
  • From Culture tab, select required Culture and UI Culture.
  • Do iisreset

atau, dapat pula dengan menambahkan parameter globalization pada Web.config

  ...
  <system.web>
        <globalization culture="en-GB" uiCulture="en-GB" />
        ...
  </system.web>
  ...

Sesuaikan parameter culture dan uiCulture dengan format regional yang digunakan, contoh diatas menggunakan Culture dan uiCulture “en-GB”.

Cara diatas akan berlaku secara global, jika ingin berlaku hanya pada page tertentu, tambahkan Culture and UICulture attributes pada directive “@ Page”:

<%@ Page UICulture="en-GB" Culture="en-GB" >

Referensi:

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: