C
clintonG
How do I format the current time as: 8:00 PM (GMT -06:00)
<%= Clinton Gallagher
<%= Clinton Gallagher
Milosz Skalecki said:Hi there lazy man :]
public string GetCustomDateString(DateTime date)
{
int difference = TimeZone.CurrentTimeZone.GetUtcOffset(date).Hours;
return string.Format(
"{0} ({1} GMT)",
date.ToString("h:mm tt"),
difference >= 0 ? "+" + difference.ToString() : difference.ToString());
}
--
Milosz Skalecki
MCP, MCAD
clintonG said:How do I format the current time as: 8:00 PM (GMT -06:00)
<%= Clinton Gallagher
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.