Hi i am Naresh, I am a Dotnet Developer From Hyderabad India
Showing posts with label c#. Show all posts
Showing posts with label c#. Show all posts
Thursday, May 23, 2013
Asp.Net How to Convert To Different Time Zones Using C#
Here I will Explain How To Get The Server Times Of Different Countries Using C#
Some Times We Come Across Different Date And Time Zones To Display, So By Using The Following Code You Can Get Different Countries Date And Time.
DateTime now = DateTime.Now; //Displays Our System Time
c.Text = "Time is " + now.ToString() + " in your System";
string zoneId = "Central European Standard Time";
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById(zoneId);
DateTime result = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi);
a.Text = "Time is " + result + " in Denmark";
string zoneId1 = "India Standard Time";
TimeZoneInfo tzi1 = TimeZoneInfo.FindSystemTimeZoneById(zoneId1);
DateTime result1 = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi1);
b.Text = "Time is " + result1 + " in India";
string zoneId2 = "Central Standard Time";
TimeZoneInfo tzi2 = TimeZoneInfo.FindSystemTimeZoneById(zoneId2);
DateTime result2 = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi2);
c.Text = "Time is " + result2 + " in Chicago";
Output:
Monday, April 8, 2013
What Is The Connection String To Connect The Excel File With Extensions .XLS or .XLSX or .CSV in C#, ASP.Net ?
Connection Strings to Read XLS And XLSX And CSV File In C#,ASP.NET
To Upload CSV File:
string CSVconnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strPathofFileCsv + @";Extended Properties='text;HDR=Yes;FMT=Delimited(,)';";To Upload XLS File:
string XLSconnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source= " + strPathofFileXls + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\"";
To Upload XLSX File:
string XLSXconnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strPathofFileXlsx + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES\";";
Labels:
.csv,
.xls,
.xlsx,
2003,
2007,
Asp.net,
aspdotnet,
c#,
Connection Strings,
csv,
Excel To Asp.net,
excel to c#.net,
xls,
xlsx
Subscribe to:
Posts (Atom)
