using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls; public partial class weiapi_ceshi : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(ConvertIntDateTime());
}
/// <summary>
/// take Unix The timestamp is converted to DateTime Type time
/// </summary>
/// <param name="d">double digital </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(, , ));
time = startTime.AddMilliseconds(d);
return time;
} /// <summary>
/// take c# DateTime The time format is converted to Unix Timestamp format , Returns the format :1468482273277
/// </summary>
/// <param name="time"> Time </param>
/// <returns>long</returns>
public static long ConvertDateTimeInt(System.DateTime time)
{
//double intResult = 0;
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(, , , , , , ));
//intResult = (time- startTime).TotalMilliseconds;
long t = (time.Ticks - startTime.Ticks) / ; // except 10000 Adjusted for 13 position
return t;
}
}
Others get the current timestamp
Java
time
JavaScript
Math.round(new Date() / 1000)
.NET / C#
(DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000
PHP
time()
MySQL
SELECT unix_timestamp(now())
SQL Server
SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE())
SQLite
SELECT strftime('%s', 'now')
PostgreSQL
SELECT extract(epoch FROM now())
Python
First import time then time.time()
Ruby
obtain Unix Time stamp :Time.now or Time.new Show Unix Time stamp :Time.now.to_i
Perl
time
Swift
NSDate().timeIntervalSince1970
Objective-C
[[NSDate date] timeIntervalSince1970]
Erlang
calendar:datetime_to_gregorian_seconds(calendar:universal_time())-719528*24*3600.
Go
import ("time") int32(time.Now().Unix())
Unix / Linux
date +%s
VBScript / ASP
DateDiff("s", "01/01/1970 00:00:00", Now())
Asp.Net Unix Time stamps and DateTime More articles on type conversion
- C# Unix Time stamps and DateTime Type conversion
/// <summary> /// take Unix The timestamp is converted to DateTime Type time /// </summary> /// <param name="d" ...
- Unix Time stamp and C# DateTime Time types are interchangeable
Unix The minimum unit of timestamps is seconds , The start time is Greenwich mean time 1970-01-01 00:00:00ConvertIntDateTime The basic idea of this method is to obtain the local time zone representation Unixk Starting time , add Unix Time ...
- MSSQL in datetime And unix Time stamp interchange
//ms sql datetime turn unix Time stamp SELECT DATEDIFF(s, '19700101',GETDATE()) //ms sql unix Time stamp turn datetime When it comes to time zones ...
- python datetime and unix Time stamps are converted to each other
python datetime and unix Time stamps are converted to each other 1. Code : import time import datetime # ...
- c#DateTime And unix Timestamps convert to each other
public class UnixTimeUtil { /// <summary> /// take dateTime Format conversion to Unix Time stamp /// </summary> /// & ...
- c# dateTime Format conversion to Unix Timestamp tool class
using System; using System.Collections.Generic; using System.Text; namespace TJCFinanceWriteOff.BizL ...
- [ Development Notes ]-unix Time stamp 、GMT Time and datetime Conversion before type time
Some time ago, the project involved MySql and MsSql Conversion between data types , Recently, I've been studying Sina Weibo's API, It's about... With time zones GMT Conversion of time type , therefore , It is recorded here , For future reference . One :UNIX Time stamp and dateti ...
- unix Time stamp converted to standard time (c#)
//---unix Time stamp converted to standard time (c#)---// /* string timeStamp = "1144821796"; DateTime dtSt ...
- UNIX Time stamp C#
/// take Unix The timestamp is converted to DateTime Type time /// </summary> /// <param name="d">double digital </ ...
Random recommendation
- Xcode7.1 It's on the shelves in the environment iOS App To AppStore technological process ③(Part 3、 ... and )
Preface part 3、 ... and The part mainly explains Xcode Associate binding to publish certificate configuration . establish App Information . Use Application Loader Upload .ipa File to AppStore One .Xcode Configure publishing certificate information 1) to ...
- The server encountered an internal error that prevented it from fulfilling this request.
type Exception report message Request processing failed; nested exception is org.mybatis.spring.MyBa ...
- linux And iptables
from http://www.geekfan.net/6921/ Iptables It's for Linux An extremely flexible firewall tool created by the operating system . Yes Linux Geek players and system administrators ,iptables Very useful . ...
- HDU 2444 The Accomodation of Students( Infer whether it's a bipartite graph )
Topic link The question :n A student ,m To the relationship , Each couple that knows each other can live in a room . Do you want to divide these students into two groups , The students in each group should not know each other . How many rooms do you need at most . Can it be divided into two groups ? That is to say, infer whether it is a bipartite graph , The way to infer bipartite graphs , use ...
- robotium test
author : He Rui link :https://www.zhihu.com/question/28466134/answer/40921012 source : It's up to the author to own the copyright , Please contact the author for permission to reprint . Just use your cell phone ...
- Direcshow Video capture and parameter setting report in
Direcshow Video capture and parameter setting report in 1. About video capture (About Video Capture in Dshow) 1 Video capture Graph The construction of One that can capture audio or video graph chart ...
- elastalert To configure post Alarm mode ( Memo )
I've been making elk The alarm log is sent to kinesis flow , For subsequent data analysis and processing ........ Based on trying not to modify elastalert , The principle of putting the modification work on the receiving end service . Plan to put elk The alarm data is sent by remote api ...
- STS in db.properties The configuration file
db.name=root db.password=root db.url=jdbc:mysql://localhost:3306/day13?useUnicode=true&character ...
- Luogu P2868 [USACO07DEC] Sightseeing cows Sightseeing Cows(01 Fractional programming )
The question Topic link Sol Review the 01 Fractional programming set up \(a_i\) For the right ,\(b_i\) For border power , We want to maximize \(\sum \frac{a_i}{b_i}\). You can split the answer in half \(k\), We need to check \(\ ...
- Idea Practical configuration
Reference resources :https://github.com/judasn/IntelliJ-IDEA-Tutorial 1. Code hints are not case sensitive 2. Jump to the specified line Ctrl + G Ctrl Shortcut key Introduce Ctrl + ...