mysql数据Unix时间戳与C# DateTime时间类型互换
Unix时间戳最小单位是秒,开始时间为格林威治标准时间1970-01-01 00:00:00
ConvertIntDateTime方法的基本思路是通过获取本地时区表示Unixk开始时间,加上Unix时间值(即过去的秒数).
ConvertDateTimeInt方法的基本思路是通过刻度数差,再把刻度数转换为秒数,当然要说明的是,我这里返回的是double类型,意义上并非是真正的Unix时间戳格式。
要获取真正Unix时间戳的,只获取整数部分就可以了。
dangranusing System;
using System.Collections.Generic;
using System.Text;
namespace WWFramework.DateTimes
{
/// <summary>
/// 时间相关函数
/// </summary>
public static class Function
{
/// <summary>
/// 将Unix时间戳转换为DateTime类型时间
/// </summary>
/// <param name="d">double 型数字</param>
/// <returns>DateTime</returns>
public static System.DateTime ConvertIntDateTime(double d)
{
System.DateTime time = System.DateTime.MinValue;
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
time = startTime.AddSeconds(d);
return time;
}
/// <summary>
/// 将c# DateTime时间格式转换为Unix时间戳格式
&nb
相关文档:
Introduction
This article is about passing data between VB.NET/C# WinForms and JavaScript.
Before reading further, let me warn you that this article is not about ASP.NET. Concepts covered in the article are applied to Desktop applications.
Background
I was working on a project which required dat ......
已知有一个XML文件(bookstore.xml)如下:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
&nb ......
格式:grant [PRIVILEGES] on [databaseName.tableName] to [userName]@[host] identified by [password] with grant option;
eg1: grant select on mysql.user to wqh@localhost
eg2:GRANT SELECT,INSERT,UPDATE,DELETE,CREATE ......
1.查看档案
mysql> show binary logs;
+----------------+-----------+
| Log_name | File_size |
+----------------+-----------+
| ablelee.000001 | 150462942 |
| ablelee.000002 | 125 |
| ablelee.000003 | 106 |
+----------------+-----------+
2.删除bin-log(删除ablelee.000003之前的而没有包含ablel ......