About the author

Vijay Kodali
E-mail me Send mail

Site Statistics

Site Meter

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Formatted Date based on the browser language setting

One of new feature that was added in Asp.net 3.5  is script globalization and localization. We can display date based on language setting of browser. Here is code snippet of displaying date in local language using script..

[code:c#]

   <script type="text/javascript">
        function formatDate() {
            var d = new Date();
            try {
                $get('Label1').innerHTML = d.localeFormat("dddd, dd MMMM yyyy HH:mm:ss");
            }
            catch (e) {
                alert("Error:" + e.message);
            }
        }
        window.onload
        {
            formatDate();
        }
    </script>

[/code]


Posted by vijay on Saturday, August 16, 2008 7:31 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading