本文整理汇总了C#中SYSTEMTIME类的典型用法代码示例。如果您正苦于以下问题:C# SYSTEMTIME类的具体用法?C# SYSTEMTIME怎么用?C# SYSTEMTIME使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SYSTEMTIME类属于命名空间,在下文中一共展示了SYSTEMTIME类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetTime
private void GetTime()
{
SYSTEMTIME stime = new SYSTEMTIME();
GetSystemTime(out stime);
//labTime.Text = "Current Time:" + stime.wYear.ToString() + "/" + stime.wMonth.ToString() + "/" + stime.wDay.ToString() + " " + stime.wHour.ToString() +":"+ stime.wMinute.ToString() +":"+ stime.wSecond.ToString();
//lblError.Text = DateTime.Now.ToString("yyyyMMdd");
}
开发者ID:yan1106,项目名称:Phase2_Project_20160625_ver.final,代码行数:7,代码来源:Login.aspx.cs
示例2: Main
static void Main(string[] args)
{
TIME_ZONE_INFORMATION tz = new TIME_ZONE_INFORMATION();
GetTimeZoneInformation(ref tz);
string s = args[0];
System.Globalization.DateTimeFormatInfo dtfi =
new System.Globalization.DateTimeFormatInfo();
dtfi.FullDateTimePattern = "dd/MM/yyyy HH:mm:ss zz";
dtfi.DateSeparator = "/";
dtfi.TimeSeparator = ":";
DateTime dt =
DateTime.Parse(s, dtfi);
SYSTEMTIME time = new SYSTEMTIME(dt);
//time.wDay = (ushort)dt.Day;
//time.wHour = (ushort)dt.Hour;
//time.wDayOfWeek = (ushort)dt.DayOfWeek;
//time.wMilliseconds = (ushort)dt.Millisecond;
//time.wMinute = (ushort)dt.Minute;
//time.wMonth = (ushort)dt.Month;
//time.wSecond = (ushort)dt.Second;
//time.wYear = (ushort)dt.Year;
SetSystemTime(ref time);
}
开发者ID:ramilexe,项目名称:tsdfamilia,代码行数:27,代码来源:Program.cs
示例3: Main
private static void Main(string[] args)
{
if (args.Length == 5)
{
var time = new SYSTEMTIME
{
wDay = ushort.Parse(args[0]),
wMonth = ushort.Parse(args[1]),
wYear = ushort.Parse(args[2]),
wHour = ushort.Parse(args[3]),
wMinute = ushort.Parse(args[4])
};
SetTime(time);
return;
}
if (File.Exists("date.txt"))
{
var tr = new StreamReader("date.txt");
string dateString = tr.ReadLine();
if (dateString != null)
{
dateString = dateString.Trim();
DateTime convertedDate = DateTime.Parse(dateString);
SetTime(convertedDate);
}
}
else
{
SetTime(1, 1, 2012, 12, 00);
}
}
开发者ID:maxisoft,项目名称:BackInTime,代码行数:32,代码来源:Program.cs
示例4: Main
static void Main(string[] args)
{
if (args.Length == 0 || (new string[] { "help", "--help", "/?" }).Contains(args[0]))
{
System.Console.WriteLine("Give as the only parameter the time difference in hours. For example \"SetClock.exe -2\" moves the clock two hours backwards.");
return;
}
double delta = 0;
try
{
delta = Convert.ToDouble(args[0]);
}
catch
{
System.Console.WriteLine("Error converting input parameter to time difference.");
return;
}
var newDateTime = DateTime.Now.ToUniversalTime().AddHours(delta);
var newSystemTime = new SYSTEMTIME();
newSystemTime.wYear = Convert.ToInt16(newDateTime.Year);
newSystemTime.wMonth = Convert.ToInt16(newDateTime.Month);
newSystemTime.wDay = Convert.ToInt16(newDateTime.Day);
newSystemTime.wDayOfWeek = Convert.ToInt16(newDateTime.DayOfWeek);
newSystemTime.wHour = Convert.ToInt16(newDateTime.Hour);
newSystemTime.wMinute = Convert.ToInt16(newDateTime.Minute);
newSystemTime.wSecond = Convert.ToInt16(newDateTime.Second);
newSystemTime.wMilliseconds = Convert.ToInt16(newDateTime.Millisecond);
SetSystemTime(ref newSystemTime);
}
开发者ID:ohel,项目名称:setclock,代码行数:32,代码来源:Program.cs
示例5: SetTime
public static void SetTime(SYSTEMTIME time)
{
if (!SetLocalTime(ref time))
{
// The native function call failed, so throw an exception
throw new Win32Exception(Marshal.GetLastWin32Error());
}
}
开发者ID:maxisoft,项目名称:BackInTime,代码行数:8,代码来源:Program.cs
示例6: ChangeDateDown
private void ChangeDateDown(int numDays)
{
DateTime t = DateTime.Now.AddDays(-1);
DateTime h = DateTime.Now.AddHours(0);
SYSTEMTIME st = new SYSTEMTIME();
st.FromDateTime(t);
SetSystemTime(ref st);
}
开发者ID:jsondotbower,项目名称:C-Apps,代码行数:8,代码来源:Form1.cs
示例7: GetTime
/// <summary>
/// Gets current system time.
/// </summary>
/// <returns></returns>
public static DateTime GetTime()
{
// Call the native GetSystemTime method
// with the defined structure.
SYSTEMTIME stime = new SYSTEMTIME();
GetSystemTime(ref stime);
var utc = new DateTime(stime.wYear, stime.wMonth, stime.wDay, stime.wHour, stime.wMinute, stime.wSecond, stime.wMilliseconds, DateTimeKind.Utc);
return utc.ToLocalTime();
}
开发者ID:NikolaR,项目名称:Convenience,代码行数:14,代码来源:SystemTime.cs
示例8: SetSystemTime
// SYSTEMTIME�\����
//
// ABSTRACT : DateTime�R���g���[���Ƀ��b�Z�[�W�
|
请发表评论