how do i get IST Zone time format.
-
Hi all, i have created html reports and displayed date by using DateTime.now.Tostring("dd-mm-yyyy") but it shows US time Zone's time but i wann display it in IST +5:30 format can u pls help me... Thanks and regards.
-
Hi all, i have created html reports and displayed date by using DateTime.now.Tostring("dd-mm-yyyy") but it shows US time Zone's time but i wann display it in IST +5:30 format can u pls help me... Thanks and regards.
Are you just wanting to add 5:30 to your local time? The simplest way would be to just code.
DateTime.Now.AddHours(5.5).Tostring("dd-mm-yyyy")
If you were wanting to make it more flexible I would suggest setting the value to add to a settings file or to your web.config so you wouldn't have to update the code everywhere should you change the location of your server.
JimBob SquarePants ******************************************************************* "He took everything personally, including our royalties!" David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager *******************************************************************
-
Hi all, i have created html reports and displayed date by using DateTime.now.Tostring("dd-mm-yyyy") but it shows US time Zone's time but i wann display it in IST +5:30 format can u pls help me... Thanks and regards.
I think either you need to configure your local time of the system to IST or adjust the time programmatically. Use
DateTime.Now.ToUniversalTime().AddHours(5).AddMinutes(30)
Also to get the format right, placeThread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("culturecode");
before your DateTime call. I hope you will get the result. :-DAbhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NET