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)
/// <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




Math.round(new Date() / 1000)

.NET / C#

(DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000




SELECT unix_timestamp(now())

SQL Server

SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE())


SELECT strftime('%s', 'now')


SELECT extract(epoch FROM now())


First import time then time.time()


obtain Unix Time stamp or Show Unix Time stamp






[[NSDate date] timeIntervalSince1970]




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

  1. C# Unix Time stamps and DateTime Type conversion

    /// <summary> /// take Unix The timestamp is converted to DateTime Type time /// </summary> /// <param name="d" ...

  2. 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 ...

  3. 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 ...

  4. 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 # ...

  5. c#DateTime And unix Timestamps convert to each other

    public class UnixTimeUtil { /// <summary> /// take dateTime Format conversion to Unix Time stamp /// </summary> /// & ...

  6. c# dateTime Format conversion to Unix Timestamp tool class

    using System; using System.Collections.Generic; using System.Text; namespace TJCFinanceWriteOff.BizL ...

  7. [ 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 ...

  8. unix Time stamp converted to standard time (c#)

    //---unix Time stamp converted to standard time (c#)---//     /*     string timeStamp = "1144821796";     DateTime dtSt ...

  9. UNIX Time stamp C#

    /// take Unix The timestamp is converted to DateTime Type time /// </summary> /// <param name="d">double digital </ ...

Random recommendation

  1. 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 ...

  2. 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 ...

  3. linux And iptables

    from 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 . ...

  4. 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 ...

  5. robotium test

    author : He Rui link : source : It's up to the author to own the copyright , Please contact the author for permission to reprint . Just use your cell phone ...

  6. 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 ...

  7. 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 ...

  8. STS in The configuration file db.password=root db.url=jdbc:mysql://localhost:3306/day13?useUnicode=true&character ...

  9. 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 \(\ ...

  10. Idea Practical configuration

    Reference resources : 1. Code hints are not case sensitive 2. Jump to the specified line Ctrl + G Ctrl Shortcut key Introduce Ctrl + ...