当前位置: 首页>>代码示例>>C#>>正文


C# DateTime.ToUnixTimestamp方法代码示例

本文整理汇总了C#中System.DateTime.ToUnixTimestamp方法的典型用法代码示例。如果您正苦于以下问题:C# DateTime.ToUnixTimestamp方法的具体用法?C# DateTime.ToUnixTimestamp怎么用?C# DateTime.ToUnixTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.DateTime的用法示例。


在下文中一共展示了DateTime.ToUnixTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StatsGetPhotostreamReferrers

 public StatReferrerCollection StatsGetPhotostreamReferrers(DateTime date, string domain, int perPage, int page)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.stats.getPhotostreamReferrers");
     dictionary.Add("date", date.ToUnixTimestamp());
     dictionary.Add("domain", domain);
     if (perPage != 0) dictionary.Add("per_page", perPage.ToString(CultureInfo.InvariantCulture));
     if (page != 0) dictionary.Add("page", page.ToString(CultureInfo.InvariantCulture));
     return GetResponse<StatReferrerCollection>(dictionary);
 }
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:10,代码来源:FlickrNetSync.cs

示例2: ToUnixTimestamp_LocalTimeValues

		public void ToUnixTimestamp_LocalTimeValues(int year, int month, int day, double expectedResult)
		{
			// Arrange
			var given = new DateTime(year, month, day);

			// Act, Assert
			given.ToUnixTimestamp().Should().Be(expectedResult);
		}
开发者ID:nelsonwellswku,项目名称:ZoneFiles.Net,代码行数:8,代码来源:DateTimeExtensionsTests.cs

示例3: StatsGetPhotostreamStats

 public Stats StatsGetPhotostreamStats(DateTime date)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.stats.getPhotostreamStats");
     dictionary.Add("date", date.ToUnixTimestamp());
     return GetResponse<Stats>(dictionary);
 }
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:7,代码来源:FlickrNetSync.cs

示例4: StatsGetPhotosetDomains

 public StatDomainCollection StatsGetPhotosetDomains(DateTime date, string photosetId, int page, int perPage)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.stats.getPhotosetDomains");
     dictionary.Add("date", date.ToUnixTimestamp());
     if (photosetId != null) dictionary.Add("photoset_id", photosetId);
     if (page != 0) dictionary.Add("page", page.ToString(CultureInfo.InvariantCulture));
     if (perPage != 0) dictionary.Add("per_page", perPage.ToString(CultureInfo.InvariantCulture));
     return GetResponse<StatDomainCollection>(dictionary);
 }
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:10,代码来源:FlickrNetSync.cs

示例5: StatsGetCollectionStats

 public Stats StatsGetCollectionStats(DateTime date, string collectionId)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.stats.getCollectionStats");
     dictionary.Add("date", date.ToUnixTimestamp());
     dictionary.Add("collection_id", collectionId);
     return GetResponse<Stats>(dictionary);
 }
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:8,代码来源:FlickrNetSync.cs

示例6: PhotosRecentlyUpdated

 public PhotoCollection PhotosRecentlyUpdated(DateTime minDate, PhotoSearchExtras extras, int page, int perPage)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.photos.recentlyUpdated");
     dictionary.Add("min_date", minDate.ToUnixTimestamp());
     if (extras != PhotoSearchExtras.None) dictionary.Add("extras", UtilityMethods.ExtrasToString(extras));
     if (page != 0) dictionary.Add("page", page.ToString(CultureInfo.InvariantCulture));
     if (perPage != 0) dictionary.Add("per_page", perPage.ToString(CultureInfo.InvariantCulture));
     return GetResponse<PhotoCollection>(dictionary);
 }
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:10,代码来源:FlickrNetSync.cs

示例7: byCreatedAt

 protected void byCreatedAt(DateTime startCreatedAt, DateTime endCreatedAt)
 {
     this.createdAt = String.Format("{0}-{1}", startCreatedAt.ToUnixTimestamp(), endCreatedAt.ToUnixTimestamp());
 }
开发者ID:paymill,项目名称:paymill-net,代码行数:4,代码来源:BaseModel.cs

示例8: ExpireAtCommand

 public ExpireAtCommand(String key, DateTime expiration) :
     this(key, expiration.ToUnixTimestamp())
 {
 }
开发者ID:vebin,项目名称:Guanima.Redis,代码行数:4,代码来源:ExpireAtCommand.cs

示例9: GetCoinFlow

        public FlowDataView GetCoinFlow(string game, AWSRegion region, DateTime start, DateTime end)
        {
            GameMonitoringConfig GameToGet = Games.Instance.GetMonitoredGames().Where(x => x.ShortTitle == game).FirstOrDefault();
            FlowDataView chart = new FlowDataView() {
                Inflows = GetFlowData(GameToGet.Id, TransactionType.AddCredits, start, end),
                Outflows = GetFlowData(GameToGet.Id, TransactionType.Purchase, start, end),
                StartDate = start.ToUnixTimestamp() * 1000
            };

            return chart;
        }
开发者ID:parallaxisjones,项目名称:angularmetricsproj,代码行数:11,代码来源:EconomyModel.cs

示例10: AddIpBan

 public async Task AddIpBan(string ip, DateTime bandate, DateTime unbandate, string bannedby, string banreason)
 {
     await ExecuteNonQuery("INSERT INTO `ip_banned` (ip, bandate, unbandate, bannedby, banreason) VALUES (@ip, @bandate, @unbandate, @bannedby, @banreason)",
         new MySqlParameter("@ip", ip), new MySqlParameter("@bandate", bandate.ToUnixTimestamp()), new MySqlParameter("@unbandate", unbandate.ToUnixTimestamp()),
         new MySqlParameter("@bannedby", bannedby), new MySqlParameter("@banreason", banreason));
 }
开发者ID:TrinityCore-Manager,项目名称:TrinityCore-Manager-v3,代码行数:6,代码来源:AuthDatabase.cs

示例11: ToUnixTimeStampTest

            public void ToUnixTimeStampTest()
            {
                var testDate = new DateTime(2014, 1, 1);
                const long expectedTimestamp = 1388534400;

                Assert.Equal(expectedTimestamp, testDate.ToUnixTimestamp());
            }
开发者ID:BilliamBrown,项目名称:Chronos,代码行数:7,代码来源:DateTimeTests.cs

示例12: Snapshot

        /// <summary>
        /// Initializes a new Snapshot, with the specified Date it was Posted
        /// </summary>
        /// <param name="Snapshot">The snapshot source</param>
        /// <param name="Date">The original date in which this snapshot was created</param>
        public Snapshot(string Snapshot, DateTime Date, StatsDatabase Database)
        {
            // Load out database connection
            this.Driver = Database;
            this.Date = Date;
            this.TimeStamp = Date.ToUnixTimestamp();

            // Get our snapshot key value pairs
            string[] Data = Snapshot.Split('\\');
            Snapshot = null;

            // Check for invalid snapshot string. All snapshots have at least 36 data pairs,
            // and has an Even number of data sectors. We must also have an "End of File" Sector
            if (Data.Length < 36 || Data.Length % 2 != 0 || !Data.Contains("EOF"))
            {
                IsValid = false;
                return;
            }

            // Define if we are central update. the "cdb_update" variable must be the LAST sector in snapshot
            this.IsCentralUpdate = (Data[Data.Length - 2] == "cdb_update" && Data[Data.Length - 1] == "1");

            // Server data
            this.ServerPrefix = Data[0];
            this.ServerName = Data[1];
            this.ServerPort = int.Parse(Data[3].ToString());
            this.QueryPort = int.Parse(Data[5].ToString());

            // Map Data
            this.MapName = Data[7];
            this.MapId = int.Parse(Data[9]);
            this.MapStart = (int)Convert.ToDouble(Data[11], CultureInfo.InvariantCulture.NumberFormat);
            this.MapEnd = (int)Convert.ToDouble(Data[13], CultureInfo.InvariantCulture.NumberFormat);

            // Misc Data
            this.WinningTeam = int.Parse(Data[15]);
            this.GameMode = int.Parse(Data[17]);
            this.Mod = Data[21];
            this.PlayersConnected = int.Parse(Data[23]);

            // Army Data
            this.WinningArmy = int.Parse(Data[25]);
            this.Team1Army = int.Parse(Data[27]);
            this.Team1Tickets = int.Parse(Data[29]);
            this.Team2Army = int.Parse(Data[31]);
            this.Team2Tickets = int.Parse(Data[33]);

            // Setup snapshot variables
            PlayerData = new Dictionary<int, Dictionary<string, string>>();
            KillData = new Dictionary<int, Dictionary<string, string>>();

            // Check for custom map, with no ID
            if (MapId == 99)
            {
                IsCustomMap = true;

                // Check for existing map data
                List<Dictionary<string, object>> Rows = Driver.Query("SELECT id FROM mapinfo WHERE [email protected]", MapName);
                if (Rows.Count == 0)
                {
                    // Create new MapId. Id's 700 - 1000 are reserved for unknown maps in the Constants.py file
                    // There should never be more then 300 unknown map id's, considering 1001 is the start of KNOWN
                    // Custom mod map id's
                    Rows = Driver.Query("SELECT COALESCE(MAX(id), 699) AS id FROM mapinfo WHERE id BETWEEN 700 AND 1000");
                    MapId = Int32.Parse(Rows[0]["id"].ToString()) + 1;

                    // Insert map data, so we dont lose this mapid we generated
                    Driver.Execute("INSERT INTO mapinfo(id, name) VALUES (@P0, @P1)", MapId, MapName);
                }
                else
                    MapId = Int32.Parse(Rows[0]["id"].ToString());
            }
            else
                IsCustomMap = (MapId >= 700);

            // Do player snapshots, sector 36 is first player
            for (int i = 36; i < Data.Length; i += 2)
            {
                // Format: "DataKey_PlayerId". PlayerId is not the PID, but rather
                // the player INDEX
                string[] Parts = Data[i].Split('_');

                // Ignore uncomplete snapshots
                if (Parts.Length == 1)
                {
                    // Unless we are at the end of file, IF there is no PID
                    // Given for an item, the snapshot is invalid!
                    if (Parts[0] == "EOF")
                        break;
                    else
                        IsValid = false;
                    return;
                }

                // If the item key is "pID", then we have a new player record
//.........这里部分代码省略.........
开发者ID:roguesupport,项目名称:ControlCenter,代码行数:101,代码来源:Snapshot.cs

示例13: byUpdatedAt

 protected void byUpdatedAt(DateTime startUpdatedAt, DateTime endUpdatedAt)
 {
     this.updatedAt = String.Format("{0}-{1}", startUpdatedAt.ToUnixTimestamp(), endUpdatedAt.ToUnixTimestamp());
 }
开发者ID:paymill,项目名称:paymill-net,代码行数:4,代码来源:BaseModel.cs

示例14: Edit

        public bool Edit(string name, DateTime dateOfStart, DateTime dateOfEnd, Teacher teacher, IRoom room, Group group)
        {
            if (EditReservation(Ptr, name, dateOfStart.ToUnixTimestamp(), dateOfEnd.ToUnixTimestamp(), teacher.Ptr, room.Ptr, group.Ptr))
            {
                Teacher = App.Teachers.SingleOrDefault(x => x.Ptr == GetReservationTeacher(Ptr));
                Room = App.Rooms.SingleOrDefault(x => x.Ptr == GetReservationRoom(Ptr));
                Group = App.Groups.SingleOrDefault(x => x.Ptr == GetReservationGroup(Ptr));

                OnPropertyChanged("Name");
                OnPropertyChanged("DateOfStart");
                OnPropertyChanged("DateOfEnd");
                InvokePropertyChanged();

                return true;
            }

            return false;
        }
开发者ID:kneefer,项目名称:UniversityReservationSystem,代码行数:18,代码来源:Reservation.cs

示例15: GetCoinFlowByCat

        public FlowDataView GetCoinFlowByCat(GameMonitoringConfig game, AWSRegion region, DateTime start, DateTime end)
        {
            FlowDataView chart = new FlowDataView()
            {
                Inflows = GetFlowDataByCategory(game.Id, TransactionType.AddCredits, start, end),
                Outflows = GetFlowDataByCategory(game.Id, TransactionType.Purchase, start, end),
                StartDate = start.ToUnixTimestamp() * 1000
            };

            return chart;
        }
开发者ID:parallaxisjones,项目名称:angularmetricsproj,代码行数:11,代码来源:EconomyModel.cs


注:本文中的System.DateTime.ToUnixTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。