.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Show The Time Of Any Country As You Wish

Posted By:Athira Sreejith       Posted Date: January 02, 2009    Points: 10    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  
 

int intHour = int.Parse(DateTime.Now.Hour.ToString());
int intMin = int.Parse(DateTime.Now.Minute.ToString());
string strHour = "";
string strAMPM = "";
string strMin = "";
if (intMin < 10)
{
strMin = "0" + intMin.ToString();
}
else
{
strMin = intMin.ToString();
}
if (intHour >= 12)
{
strHour = Convert.ToString(intHour - 12);
strAMPM = " PM";
}
else
{
strHour = intHour.ToString();
strAMPM = " AM";
}



Please Adjust At This Line WHatever You Want strHour = Convert.ToString(intHour - 12);



     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend