473,738 Members | 11,192 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I parse a date w/ a time zone?

The date string: "Thu, 17 Jul 2003 12:35:18 PST"

The problem:

// this fails on PST
DateTime myDate = DateTime.Parse( "Thu, 17 Jul 2003 12:35:18 PST");

Help?

Jon
Nov 13 '05 #1
3 35096

"Jon Davis" <jo*@REMOVE.ME. PLEASE.jondavis .net> wrote in message news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
The date string: "Thu, 17 Jul 2003 12:35:18 PST"

The problem:

// this fails on PST
DateTime myDate = DateTime.Parse( "Thu, 17 Jul 2003 12:35:18 PST");

Help?

Jon



*sigh* This kludge is what I've wound up doing ...

public static DateTime ParseDateTime(s tring dateTime) {
try {
return DateTime.Parse( dateTime,
System.Globaliz ation.DateTimeF ormatInfo.Invar iantInfo,
System.Globaliz ation.DateTimeS tyles.AllowWhit eSpaces);
} catch (FormatExceptio n fex) {
string loc = fex.Message.Sub string(fex.Mess age.LastIndexOf (" "));
loc = loc.Substring(0 , loc.LastIndexOf ("."));
int iLoc = int.Parse(loc);
string tz = dateTime.Substr ing(iLoc);
tz = TimeZoneToOffse t(tz);
dateTime = dateTime.Substr ing(0, iLoc);
DateTime ret = DateTime.Parse( dateTime,
System.Globaliz ation.DateTimeF ormatInfo.Invar iantInfo,
System.Globaliz ation.DateTimeS tyles.AllowWhit eSpaces);

// offset for time zone
if (tz.Length > 0) {
try {
if (tz.Length == 4 && tz.Substring(0, 1) != "-") {
try {
int.Parse(tz.Su bstring(0, 1));
tz = "+" + tz;
} catch {
}
}
if (tz.Length == 5 && tz.Substring(0, 1) == "-" ||
tz.Length == 5 && tz.Substring(0, 1) == "+") {
try {
int h = int.Parse(tz.Su bstring(1, 2));
int m = int.Parse(tz.Su bstring(3, 2));
if (tz.Substring(0 , 1) == "-") {
ret = ret.AddHours((h + SysDTOffset.Hou rs) * -1);
ret = ret.AddMinutes( (m + SysDTOffset.Min utes) * -1);
} else {
ret = ret.AddHours(h + SysDTOffset.Hou rs);
ret = ret.AddMinutes( m + SysDTOffset.Min utes);
}
} catch {
}
}
} catch {}
}

return ret;
}
}

private static TimeSpan SysDTOffset {
get {
return System.TimeZone .CurrentTimeZon e.GetUtcOffset( DateTime.Now);
}
}

public static string TimeZoneToOffse t(string tz) {
tz = tz.ToUpper().Tr im();
//tz = "blaaaah";
for (int i=0; i<TimeZones.Len gth; i++) {
if (((string)((str ing[])TimeZones.GetV alue(i)).GetVal ue(0)) == tz) {
return ((string)((stri ng[])TimeZones.GetV alue(i)).GetVal ue(1));
}
}
return System.TimeZone .CurrentTimeZon e.GetUtcOffset( DateTime.Now).T oString()
.Replace(":", "").Substring(0 , 5);
}

public static string[][] TimeZones = new string[][] {
new string[] {"ACDT", "-1030", "Australian Central Daylight"},
new string[] {"ACST", "-0930", "Australian Central Standard"},
new string[] {"ADT", "+0300", "(US) Atlantic Daylight"},
new string[] {"AEDT", "-1100", "Australian East Daylight"},
new string[] {"AEST", "-1000", "Australian East Standard"},
new string[] {"AHDT", "+0900", ""},
new string[] {"AHST", "+1000", ""},
new string[] {"AST", "+0400", "(US) Atlantic Standard"},
new string[] {"AT", "+0200", "Azores"},
new string[] {"AWDT", "-0900", "Australian West Daylight"},
new string[] {"AWST", "-0800", "Australian West Standard"},
new string[] {"BAT", "-0300", "Bhagdad"},
new string[] {"BDST", "-0200", "British Double Summer"},
new string[] {"BET", "+1100", "Bering Standard"},
new string[] {"BST", "+0300", "Brazil Standard"},
new string[] {"BT", "-0300", "Baghdad"},
new string[] {"BZT2", "+0300", "Brazil Zone 2"},
new string[] {"CADT", "-1030", "Central Australian Daylight"},
new string[] {"CAST", "-0930", "Central Australian Standard"},
new string[] {"CAT", "+1000", "Central Alaska"},
new string[] {"CCT", "-0800", "China Coast"},
new string[] {"CDT", "+0500", "(US) Central Daylight"},
new string[] {"CED", "-0200", "Central European Daylight"},
new string[] {"CET", "-0100", "Central European"},
new string[] {"CST", "+0600", "(US) Central Standard"},
new string[] {"EAST", "-1000", "Eastern Australian Standard"},
new string[] {"EDT", "+0400", "(US) Eastern Daylight"},
new string[] {"EED", "-0300", "Eastern European Daylight"},
new string[] {"EET", "-0200", "Eastern Europe"},
new string[] {"EEST", "-0300", "Eastern Europe Summer"},
new string[] {"EST", "+0500", "(US) Eastern Standard"},
new string[] {"FST", "-0200", "French Summer"},
new string[] {"FWT", "-0100", "French Winter"},
new string[] {"GMT", "+0000", "Greenwich Mean"},
new string[] {"GST", "-1000", "Guam Standard"},
new string[] {"HDT", "+0900", "Hawaii Daylight"},
new string[] {"HST", "+1000", "Hawaii Standard"},
new string[] {"IDLE", "-1200", "Internatio n Date Line East"},
new string[] {"IDLW", "+1200", "Internatio n Date Line West"},
new string[] {"IST", "-0530", "Indian Standard"},
new string[] {"IT", "-0330", "Iran"},
new string[] {"JST", "-0900", "Japan Standard"},
new string[] {"JT", "-0700", "Java"},
new string[] {"MDT", "+0600", "(US) Mountain Daylight"},
new string[] {"MED", "-0200", "Middle European Daylight"},
new string[] {"MET", "-0100", "Middle European"},
new string[] {"MEST", "-0200", "Middle European Summer"},
new string[] {"MEWT", "-0100", "Middle European Winter"},
new string[] {"MST", "+0700", "(US) Mountain Standard"},
new string[] {"MT", "-0800", "Moluccas"} ,
new string[] {"NDT", "+0230", "Newfoundla nd Daylight"},
new string[] {"NFT", "+0330", "Newfoundland"} ,
new string[] {"NT", "+1100", "Nome"},
new string[] {"NST", "-0630", "North Sumatra"},
new string[] {"NZ", "-1100", "New Zealand "},
new string[] {"NZST", "-1200", "New Zealand Standard"},
new string[] {"NZDT", "-1300", "New Zealand Daylight"},
new string[] {"NZT", "-1200", "New Zealand
new string[] {"PDT", "+0700", "(US) Pacific Daylight"},
new string[] {"PST", "+0800", "(US) Pacific Standard"},
new string[] {"ROK", "-0900", "Republic of Korea"},
new string[] {"SAD", "-1000", "South Australia Daylight"},
new string[] {"SAST", "-0900", "South Australia Standard"},
new string[] {"SAT", "-0900", "South Australia Standard"},
new string[] {"SDT", "-1000", "South Australia Daylight"},
new string[] {"SST", "-0200", "Swedish Summer"},
new string[] {"SWT", "-0100", "Swedish Winter"},
new string[] {"USZ3", "-0400", "USSR Zone 3"},
new string[] {"USZ4", "-0500", "USSR Zone 4"},
new string[] {"USZ5", "-0600", "USSR Zone 5"},
new string[] {"USZ6", "-0700", "USSR Zone 6"},
new string[] {"UT", "+0000", "Universal Coordinated"},
new string[] {"UTC", "+0000", "Universal Coordinated"},
new string[] {"UZ10", "-1100", "USSR Zone 10"},
new string[] {"WAT", "+0100", "West Africa"},
new string[] {"WET", "+0000", "West European"},
new string[] {"WST", "-0800", "West Australian Standard"},
new string[] {"YDT", "+0800", "Yukon Daylight"},
new string[] {"YST", "+0900", "Yukon Standard"},
new string[] {"ZP4", "-0400", "USSR Zone 3"},
new string[] {"ZP5", "-0500", "USSR Zone 4"},
new string[] {"ZP6", "-0600", "USSR Zone 5"}
};

Nov 13 '05 #2
"Jon Davis" <jo*@REMOVE.ME. PLEASE.jondavis .net> wrote in
news:#E******** ******@TK2MSFTN GP11.phx.gbl:
The date string: "Thu, 17 Jul 2003 12:35:18 PST"

The problem:

// this fails on PST
DateTime myDate = DateTime.Parse( "Thu, 17 Jul 2003 12:35:18
PST");


Jon,

If I understand correctly, you want to convert a DateTime w/ a
TimeZone specifier into a local DateTime value. Right? If so, I
made some mods to your code (posted below). Regular expressions
greatly simplified things.

Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
using System;
using System.Text.Reg ularExpressions ;

namespace Main
{
public class MainClass
{
public static void Main(string[] args)
{
string s = "Thu, 17 Jul 2003 12:35:18 -0900";

try
{
Console.WriteLi ne("Original time: {0}", s);
Console.WriteLi ne("Converted to local time: {0}",
ParseDateTime(s ));
}
catch (FormatExceptio n ex)
{
Console.WriteLi ne(ex.Message);
}
}

public static DateTime ParseDateTime(s tring dateTime)
{
DateTime result;

// The dateTime parameter is either local (no time
// zone specified), or it has a time zone.
// Use the regex to examine the last part of the
// dateTime string and determine which category it falls into.

Match m =
Regex.Match(dat eTime.Trim(), @"(\b\w{3,4} |[+-]?\d{4})$");

if (m.Length == 0)
{
// Local date (no time zone).
result = DateTime.Parse( dateTime);
}
else
// Date w/ time zone. m.Value holds the time zone info
// (either a time zone name (e.g. PST), or the
// numeric offset (e.g. -0800).
result = ConvertToLocalD ateTime(dateTim e, m.Value);

return result;
}

private static DateTime ConvertToLocalD ateTime(
string dateTime,
string timeZoneId)
{
// Strip the time zone ID from the end of the dateTime string.
dateTime = dateTime.Replac e(timeZoneId, "").Trim();

// Convert the timeZoneId to a TimeSpan.
// (Leading + signs aren't allowed in the TimeSpan.Parse
// parameter, although leading - signs are.
// The purpose of the [+]*? at the beginning of the
// regex is to account for, and ignore, any leading + sign).

string ts = Regex.Replace(G etTimeZoneOffse t(timeZoneId),
@"^[+]*?(?<hours>[-]?\d\d)(?<minute s>\d\d)$",
"${hours}:${min utes}:00");
TimeSpan timeZoneOffset = TimeSpan.Parse( ts);

TimeSpan localUtcOffset =
TimeZone.Curren tTimeZone.GetUt cOffset(DateTim e.Now);

// Get the absolute time difference between the given
// datetime's time zone and the local datetime's time zone.

TimeSpan absoluteOffset = timeZoneOffset - localUtcOffset;
absoluteOffset = absoluteOffset. Duration();

// Now that the absolute time difference is known,
// determine whether to add or subtract it from the
// given dateTime, and then return the result.

if (timeZoneOffset < localUtcOffset)
return DateTime.Parse( dateTime) + absoluteOffset;
else
return DateTime.Parse( dateTime) - absoluteOffset;
}

/// <summary>
/// Converts a time zone (e.g. "PST") to an offset string
/// (e.g. "-0700").
/// </summary>
/// <param name="tz">The time zone to convert.</param>
/// <returns>The offset value (e.g. -0700).</returns>
private static string GetTimeZoneOffs et(string tz)
{
// If the time zone is already in number format,
// just return it.
if (Regex.IsMatch( tz, @"^[+-]?\d{4}$"))
return tz;

string result = string.Empty;

foreach (string[] sa in TimeZones)
{
if (sa[0].ToUpper() == tz)
{
result = sa[1];
break;
}
}

return result;
}

/// <summary>
/// An array of time zones
/// (e.g. new string[] {"PST", "-0700", "(US) Pacific
/// Standard"}).
/// </summary>
private static string[][] TimeZones = new string[][] {
new string[] {"ACDT", "+1030", "Australian Central Daylight"},
new string[] {"ACST", "+0930", "Australian Central Standard"},
new string[] {"ADT", "-0300", "(US) Atlantic Daylight"},
new string[] {"AEDT", "+1100", "Australian East Daylight"},
new string[] {"AEST", "+1000", "Australian East Standard"},
new string[] {"AHDT", "-0900", ""},
new string[] {"AHST", "-1000", ""},
new string[] {"AST", "-0400", "(US) Atlantic Standard"},
new string[] {"AT", "-0200", "Azores"},
new string[] {"AWDT", "+0900", "Australian West Daylight"},
new string[] {"AWST", "+0800", "Australian West Standard"},
new string[] {"BAT", "+0300", "Bhagdad"},
new string[] {"BDST", "+0200", "British Double Summer"},
new string[] {"BET", "-1100", "Bering Standard"},
new string[] {"BST", "-0300", "Brazil Standard"},
new string[] {"BT", "+0300", "Baghdad"},
new string[] {"BZT2", "-0300", "Brazil Zone 2"},
new string[] {"CADT", "+1030", "Central Australian Daylight"},
new string[] {"CAST", "+0930", "Central Australian Standard"},
new string[] {"CAT", "-1000", "Central Alaska"},
new string[] {"CCT", "+0800", "China Coast"},
new string[] {"CDT", "-0500", "(US) Central Daylight"},
new string[] {"CED", "+0200", "Central European Daylight"},
new string[] {"CET", "+0100", "Central European"},
new string[] {"CST", "-0600", "(US) Central Standard"},
new string[] {"CENTRAL", "-0600", "(US) Central Standard"},
new string[] {"EAST", "+1000", "Eastern Australian Standard"},
new string[] {"EDT", "-0400", "(US) Eastern Daylight"},
new string[] {"EED", "+0300", "Eastern European Daylight"},
new string[] {"EET", "+0200", "Eastern Europe"},
new string[] {"EEST", "+0300", "Eastern Europe Summer"},
new string[] {"EST", "-0500", "(US) Eastern Standard"},
new string[] {"EASTERN", "-0500", "(US) Eastern Standard"},
new string[] {"FST", "+0200", "French Summer"},
new string[] {"FWT", "+0100", "French Winter"},
new string[] {"GMT", "-0000", "Greenwich Mean"},
new string[] {"GST", "+1000", "Guam Standard"},
new string[] {"HDT", "-0900", "Hawaii Daylight"},
new string[] {"HST", "-1000", "Hawaii Standard"},
new string[] {"IDLE", "+1200", "Internatio n Date Line East"},
new string[] {"IDLW", "-1200", "Internatio n Date Line West"},
new string[] {"IST", "+0530", "Indian Standard"},
new string[] {"IT", "+0330", "Iran"},
new string[] {"JST", "+0900", "Japan Standard"},
new string[] {"JT", "+0700", "Java"},
new string[] {"MDT", "-0600", "(US) Mountain Daylight"},
new string[] {"MED", "+0200", "Middle European Daylight"},
new string[] {"MET", "+0100", "Middle European"},
new string[] {"MEST", "+0200", "Middle European Summer"},
new string[] {"MEWT", "+0100", "Middle European Winter"},
new string[] {"MST", "-0700", "(US) Mountain Standard"},
new string[] {"MOUNTAIN", "-0700", "(US) Mountain Standard"},
new string[] {"MT", "+0800", "Moluccas"} ,
new string[] {"NDT", "-0230", "Newfoundla nd Daylight"},
new string[] {"NFT", "-0330", "Newfoundland"} ,
new string[] {"NT", "-1100", "Nome"},
new string[] {"NST", "+0630", "North Sumatra"},
new string[] {"NZ", "+1100", "New Zealand "},
new string[] {"NZST", "+1200", "New Zealand Standard"},
new string[] {"NZDT", "+1300", "New Zealand Daylight "},
new string[] {"NZT", "+1200", "New Zealand"},
new string[] {"PDT", "-0700", "(US) Pacific Daylight"},
new string[] {"PST", "-0800", "(US) Pacific Standard"},
new string[] {"PACIFIC", "-0800", "(US) Pacific Standard"},
new string[] {"ROK", "+0900", "Republic of Korea"},
new string[] {"SAD", "+1000", "South Australia Daylight"},
new string[] {"SAST", "+0900", "South Australia Standard"},
new string[] {"SAT", "+0900", "South Australia Standard"},
new string[] {"SDT", "+1000", "South Australia Daylight"},
new string[] {"SST", "+0200", "Swedish Summer"},
new string[] {"SWT", "+0100", "Swedish Winter"},
new string[] {"USZ3", "+0400", "USSR Zone 3"},
new string[] {"USZ4", "+0500", "USSR Zone 4"},
new string[] {"USZ5", "+0600", "USSR Zone 5"},
new string[] {"USZ6", "+0700", "USSR Zone 6"},
new string[] {"UT", "-0000", "Universal Coordinated"},
new string[] {"UTC", "-0000", "Universal Coordinated"},
new string[] {"UZ10", "+1100", "USSR Zone 10"},
new string[] {"WAT", "-0100", "West Africa"},
new string[] {"WET", "-0000", "West European"},
new string[] {"WST", "+0800", "West Australian Standard"},
new string[] {"YDT", "-0800", "Yukon Daylight"},
new string[] {"YST", "-0900", "Yukon Standard"},
new string[] {"ZP4", "+0400", "USSR Zone 3"},
new string[] {"ZP5", "+0500", "USSR Zone 4"},
new string[] {"ZP6", "+0600", "USSR Zone 5"}
};
}
}
Nov 13 '05 #3
Wow, hey thanks!

I'm surprised this stuff isn't built in, though!!!! :( Or is it? Anyone
know?

Jon
"Chris R. Timmons" <crtimmons@X_NO SPAM_Xcrtimmons inc.com> wrote in message
news:Xn******** *************** ***********@207 .46.248.16...
"Jon Davis" <jo*@REMOVE.ME. PLEASE.jondavis .net> wrote in
news:#E******** ******@TK2MSFTN GP11.phx.gbl:
The date string: "Thu, 17 Jul 2003 12:35:18 PST"

The problem:

// this fails on PST
DateTime myDate = DateTime.Parse( "Thu, 17 Jul 2003 12:35:18
PST");


Jon,

If I understand correctly, you want to convert a DateTime w/ a
TimeZone specifier into a local DateTime value. Right? If so, I
made some mods to your code (posted below). Regular expressions
greatly simplified things.

Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
using System;
using System.Text.Reg ularExpressions ;

namespace Main
{
public class MainClass
{
public static void Main(string[] args)
{
string s = "Thu, 17 Jul 2003 12:35:18 -0900";

try
{
Console.WriteLi ne("Original time: {0}", s);
Console.WriteLi ne("Converted to local time: {0}",
ParseDateTime(s ));
}
catch (FormatExceptio n ex)
{
Console.WriteLi ne(ex.Message);
}
}

public static DateTime ParseDateTime(s tring dateTime)
{
DateTime result;

// The dateTime parameter is either local (no time
// zone specified), or it has a time zone.
// Use the regex to examine the last part of the
// dateTime string and determine which category it falls into.

Match m =
Regex.Match(dat eTime.Trim(), @"(\b\w{3,4} |[+-]?\d{4})$");

if (m.Length == 0)
{
// Local date (no time zone).
result = DateTime.Parse( dateTime);
}
else
// Date w/ time zone. m.Value holds the time zone info
// (either a time zone name (e.g. PST), or the
// numeric offset (e.g. -0800).
result = ConvertToLocalD ateTime(dateTim e, m.Value);

return result;
}

private static DateTime ConvertToLocalD ateTime(
string dateTime,
string timeZoneId)
{
// Strip the time zone ID from the end of the dateTime string.
dateTime = dateTime.Replac e(timeZoneId, "").Trim();

// Convert the timeZoneId to a TimeSpan.
// (Leading + signs aren't allowed in the TimeSpan.Parse
// parameter, although leading - signs are.
// The purpose of the [+]*? at the beginning of the
// regex is to account for, and ignore, any leading + sign).

string ts = Regex.Replace(G etTimeZoneOffse t(timeZoneId),
@"^[+]*?(?<hours>[-]?\d\d)(?<minute s>\d\d)$",
"${hours}:${min utes}:00");
TimeSpan timeZoneOffset = TimeSpan.Parse( ts);

TimeSpan localUtcOffset =
TimeZone.Curren tTimeZone.GetUt cOffset(DateTim e.Now);

// Get the absolute time difference between the given
// datetime's time zone and the local datetime's time zone.

TimeSpan absoluteOffset = timeZoneOffset - localUtcOffset;
absoluteOffset = absoluteOffset. Duration();

// Now that the absolute time difference is known,
// determine whether to add or subtract it from the
// given dateTime, and then return the result.

if (timeZoneOffset < localUtcOffset)
return DateTime.Parse( dateTime) + absoluteOffset;
else
return DateTime.Parse( dateTime) - absoluteOffset;
}

/// <summary>
/// Converts a time zone (e.g. "PST") to an offset string
/// (e.g. "-0700").
/// </summary>
/// <param name="tz">The time zone to convert.</param>
/// <returns>The offset value (e.g. -0700).</returns>
private static string GetTimeZoneOffs et(string tz)
{
// If the time zone is already in number format,
// just return it.
if (Regex.IsMatch( tz, @"^[+-]?\d{4}$"))
return tz;

string result = string.Empty;

foreach (string[] sa in TimeZones)
{
if (sa[0].ToUpper() == tz)
{
result = sa[1];
break;
}
}

return result;
}

/// <summary>
/// An array of time zones
/// (e.g. new string[] {"PST", "-0700", "(US) Pacific
/// Standard"}).
/// </summary>
private static string[][] TimeZones = new string[][] {
new string[] {"ACDT", "+1030", "Australian Central Daylight"},
new string[] {"ACST", "+0930", "Australian Central Standard"},
new string[] {"ADT", "-0300", "(US) Atlantic Daylight"},
new string[] {"AEDT", "+1100", "Australian East Daylight"},
new string[] {"AEST", "+1000", "Australian East Standard"},
new string[] {"AHDT", "-0900", ""},
new string[] {"AHST", "-1000", ""},
new string[] {"AST", "-0400", "(US) Atlantic Standard"},
new string[] {"AT", "-0200", "Azores"},
new string[] {"AWDT", "+0900", "Australian West Daylight"},
new string[] {"AWST", "+0800", "Australian West Standard"},
new string[] {"BAT", "+0300", "Bhagdad"},
new string[] {"BDST", "+0200", "British Double Summer"},
new string[] {"BET", "-1100", "Bering Standard"},
new string[] {"BST", "-0300", "Brazil Standard"},
new string[] {"BT", "+0300", "Baghdad"},
new string[] {"BZT2", "-0300", "Brazil Zone 2"},
new string[] {"CADT", "+1030", "Central Australian Daylight"},
new string[] {"CAST", "+0930", "Central Australian Standard"},
new string[] {"CAT", "-1000", "Central Alaska"},
new string[] {"CCT", "+0800", "China Coast"},
new string[] {"CDT", "-0500", "(US) Central Daylight"},
new string[] {"CED", "+0200", "Central European Daylight"},
new string[] {"CET", "+0100", "Central European"},
new string[] {"CST", "-0600", "(US) Central Standard"},
new string[] {"CENTRAL", "-0600", "(US) Central Standard"},
new string[] {"EAST", "+1000", "Eastern Australian Standard"},
new string[] {"EDT", "-0400", "(US) Eastern Daylight"},
new string[] {"EED", "+0300", "Eastern European Daylight"},
new string[] {"EET", "+0200", "Eastern Europe"},
new string[] {"EEST", "+0300", "Eastern Europe Summer"},
new string[] {"EST", "-0500", "(US) Eastern Standard"},
new string[] {"EASTERN", "-0500", "(US) Eastern Standard"},
new string[] {"FST", "+0200", "French Summer"},
new string[] {"FWT", "+0100", "French Winter"},
new string[] {"GMT", "-0000", "Greenwich Mean"},
new string[] {"GST", "+1000", "Guam Standard"},
new string[] {"HDT", "-0900", "Hawaii Daylight"},
new string[] {"HST", "-1000", "Hawaii Standard"},
new string[] {"IDLE", "+1200", "Internatio n Date Line East"},
new string[] {"IDLW", "-1200", "Internatio n Date Line West"},
new string[] {"IST", "+0530", "Indian Standard"},
new string[] {"IT", "+0330", "Iran"},
new string[] {"JST", "+0900", "Japan Standard"},
new string[] {"JT", "+0700", "Java"},
new string[] {"MDT", "-0600", "(US) Mountain Daylight"},
new string[] {"MED", "+0200", "Middle European Daylight"},
new string[] {"MET", "+0100", "Middle European"},
new string[] {"MEST", "+0200", "Middle European Summer"},
new string[] {"MEWT", "+0100", "Middle European Winter"},
new string[] {"MST", "-0700", "(US) Mountain Standard"},
new string[] {"MOUNTAIN", "-0700", "(US) Mountain Standard"},
new string[] {"MT", "+0800", "Moluccas"} ,
new string[] {"NDT", "-0230", "Newfoundla nd Daylight"},
new string[] {"NFT", "-0330", "Newfoundland"} ,
new string[] {"NT", "-1100", "Nome"},
new string[] {"NST", "+0630", "North Sumatra"},
new string[] {"NZ", "+1100", "New Zealand "},
new string[] {"NZST", "+1200", "New Zealand Standard"},
new string[] {"NZDT", "+1300", "New Zealand Daylight "},
new string[] {"NZT", "+1200", "New Zealand"},
new string[] {"PDT", "-0700", "(US) Pacific Daylight"},
new string[] {"PST", "-0800", "(US) Pacific Standard"},
new string[] {"PACIFIC", "-0800", "(US) Pacific Standard"},
new string[] {"ROK", "+0900", "Republic of Korea"},
new string[] {"SAD", "+1000", "South Australia Daylight"},
new string[] {"SAST", "+0900", "South Australia Standard"},
new string[] {"SAT", "+0900", "South Australia Standard"},
new string[] {"SDT", "+1000", "South Australia Daylight"},
new string[] {"SST", "+0200", "Swedish Summer"},
new string[] {"SWT", "+0100", "Swedish Winter"},
new string[] {"USZ3", "+0400", "USSR Zone 3"},
new string[] {"USZ4", "+0500", "USSR Zone 4"},
new string[] {"USZ5", "+0600", "USSR Zone 5"},
new string[] {"USZ6", "+0700", "USSR Zone 6"},
new string[] {"UT", "-0000", "Universal Coordinated"},
new string[] {"UTC", "-0000", "Universal Coordinated"},
new string[] {"UZ10", "+1100", "USSR Zone 10"},
new string[] {"WAT", "-0100", "West Africa"},
new string[] {"WET", "-0000", "West European"},
new string[] {"WST", "+0800", "West Australian Standard"},
new string[] {"YDT", "-0800", "Yukon Daylight"},
new string[] {"YST", "-0900", "Yukon Standard"},
new string[] {"ZP4", "+0400", "USSR Zone 3"},
new string[] {"ZP5", "+0500", "USSR Zone 4"},
new string[] {"ZP6", "+0600", "USSR Zone 5"}
};
}
}

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
359
by: lou | last post by:
When sending a date value to a web service, does .NET know what time zone that date is sent from? The reason I ask is because I have client software that sends data to our web service and when a date is received, it's different than what had been entered in the client software. The client is in a different time zone than the server that the web service is located on and that's what the dates are different by - the time zone.
38
7161
by: | last post by:
I have a script... ----- <SCRIPT language="JavaScript" type="text/javascript"> <!-- function makeArray() { for (i = 0; i<makeArray.arguments.length; i++) this = makeArray.arguments; } function makeArray0() {
11
4674
by: lduperval | last post by:
Hi, I`m trying to do date calculations in three types of time zones: local, GMT and specified. The issue I am facing is that I need to be able to specify a date in the proper time zone, and I`m having a heck of a time doing so. I have created a form where I use drop downs do specify year, month, date, hour, minute and seconds. When the form is loaded, the dropdowns have to display the proper values for the current time zone type. This
14
3684
by: Jon Davis | last post by:
I have put my users through so much crap with this bug it is an absolute shame. I have a product that reads/writes RSS 2.0 documents, among other things. The RSS 2.0 spec mandates an en-US style of date formatting (RFC 822). I have been using a variation of RFC 1123 (just change the time zone to an offset, i.e. "-0800"). It seems to be writing okay, but it's failing to parse. I've tried changing the regional & language settings in my...
17
3367
by: Franc Zabkar | last post by:
My D-Link DSL-302G modem/router has a real-time clock whose settings are volatile. To avoid hand keying the date/time via the modem's JS interface, I wonder if there is a way to copy the JS code to the hard drive and modify it to automatically retrieve the PC's date/time. I could then add the hacked JS page to my browser's bookmarks. I've already successfully modified and adapted other modem menus, but I don't know how to go about this...
3
4288
by: Ben | last post by:
Hi, Can anyone explain why this, Date.parse("Jan 1, 1970") equals this, 18000000 ? Microsoft's documentation reports this, " The parse method returns an integer value representing the number of
7
4583
by: David E. Ross | last post by:
My Web site is hosted by my ISP on an Apache server. Some of my pages display dynamic "Last Updated" dates by using the LAST_MODIFIED environment variable in the following SSI: <!--#config timefmt="%e %B %Y" --><!--#echo var="LAST_MODIFIED" --> Note that the formatting is for day month year. The server is in the same time zone as where I live (just about 2 miles away). When someone sees the "Last Updated" date, will they see it...
1
3078
by: =?Utf-8?B?YXZucmFv?= | last post by:
We have a web service that gets data in xml format. In that Xml data, we parse few date fields that are in this format <data datefield="12/26/2008" timefield="16:33:45" ...> we parse it into a DateTime field using DateTime.Parse( datefield ).Add( TimeSpan.Parse( timefield ). For some reason, on 26th of this month from 4pm to 5pm, for certain web service calls, the date field was calculated incorrectly. Like a 12/26/2008 16:00:00 would...
14
1911
by: shapper | last post by:
Hello, Is there any function to convert a Date/Time from UTC to the user client zone and back from user client zone to UTC? I want to store Date/Time in UTC in the database but display it in local use Date/Time. Thanks, Miguel
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8210
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.