Lazy question about displaying current time

G

Guest

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());
}
 
C

clintonG

Hi there Milosz. Thanks...

<%= 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
 

Ask a Question

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top