读书人

paip.获取现阶段实际北京时间API

发布时间: 2013-02-25 10:23:36 作者: rapoo

paip.获取当前实际北京时间API


paip.获取当前实际北京时间API






MOLE.DLL


MOLE.Common.datetimeC2n.getCurtime()








"http://www.time.ac.cn/timeflash.asp?user=flash", "gbk");








<?xml version="1.0" encoding="GB2312" ?>
- <ntsc>
- <time>
<year>2013</year>
<month>2</month>
<day>24</day>
<Weekday />
<hour>23</hour>
<minite>45</minite>
<second>12</second>
<Millisecond />
</time>
</ntsc>
















public static DateTime getCurtime()
{






http hc = new http();
hc.getMethod = true;
string xml = hc.gethtm4byeve3("http://www.time.ac.cn/timeflash.asp?user=flash", "gbk");




XmlNode xmlNode = XMLHelper.GetXmlNodeByXpathFromStr(xml, "/ntsc/time/year");
string year = xmlNode.InnerText;
string month = XMLHelper.GetXmlNodeByXpathFromStr(xml, "/ntsc/time/month").InnerText;
if (month.Length == 1)
month = "0" + month;
string day = XMLHelper.GetXmlNodeByXpathFromStr(xml, "/ntsc/time/day").InnerText;
day = getDoubleLength(day);
string hour = XMLHelper.GetXmlNodeByXpathFromStr(xml, "/ntsc/time/hour").InnerText;
hour = getDoubleLength(hour);
string min = XMLHelper.GetXmlNodeByXpathFromStr(xml, "/ntsc/time/minite").InnerText;
min = getDoubleLength(min);
string sec = XMLHelper.GetXmlNodeByXpathFromStr(xml, "/ntsc/time/second").InnerText;
sec = getDoubleLength(sec);
string st1 = year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec;


DateTime dt1 = Convert.ToDateTime(st1); return dt1;
}













读书人网 >网络基础

热点推荐