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
相关文档:
mysql 基本命令
第一招、mysql服务的启动和停止
net stop mysql
net start mysql
第二招、登陆mysql
语法如下: mysql -u用户名 -p用户密码
键入命令mysql -uroot -p, 回车后提示你输入密码,输入12345,然后回车即可进入到mysql中了,mysql的提示符是:
mysql>
注意,如果是连接到另外的机器上,则需要 ......
1、打开文本编辑my.cnf
sudo gedit /etc/mysql/my.cnf
在[client]
节点,添加
default-character-set=utf8 (客户端缺省以utf8存储)
在[mysqld]
节点,添加
default-character-set=utf8 (数据库缺省以utf8存储)
init_connect='SET NAMES utf8'
(设定连接mysql数据库时使用utf8编码,以让mysql数据库为utf8 ......
在 .NET 里面使用 SQLite, 我这里使用的wrapper是 System.Data.SQLite,它只需要一个dll,接口符合ADO.Net 2.0的定义,性能也不错,NHibernate用的也是它,目前支持ADO.NET 3.5了,支持集成在 VS2005 和 VS2008里面,而且支持wince,是个亮点
因为符合ADO.NET的规范,所以使用方式,基本和 SqlClient, OleDb等原生的一致
us ......
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 ......
在2003系统下,按照在IIS6中网站右键属性-主目录-配置-在通配符应用程序映射-插入设置添加统配符,可执行文件选择C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll 注意“确认文件是否存在”这个选项不要选上
2 站点中引入UrlRewrting.dll
3 Web.config配置修改如下:
<RewriterConfig& ......