{"id":15984926,"url":"https://github.com/divineomega/php-dot-net-ticks","last_synced_at":"2025-10-24T08:43:44.600Z","repository":{"id":56969673,"uuid":"120622320","full_name":"DivineOmega/php-dot-net-ticks","owner":"DivineOmega","description":"⏱ PHP .NET Ticks helps you convert .NET ticks, a form of precise time measurement used by the .NET DateTime object.","archived":false,"fork":false,"pushed_at":"2018-03-09T16:54:12.000Z","size":28,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T06:04:31.871Z","etag":null,"topics":["date","datetime","dot-net","dotnet","php","php-library","time"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DivineOmega.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-07T14:00:41.000Z","updated_at":"2020-03-24T17:23:46.000Z","dependencies_parsed_at":"2022-08-21T06:40:28.031Z","dependency_job_id":null,"html_url":"https://github.com/DivineOmega/php-dot-net-ticks","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Fphp-dot-net-ticks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Fphp-dot-net-ticks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Fphp-dot-net-ticks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Fphp-dot-net-ticks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DivineOmega","download_url":"https://codeload.github.com/DivineOmega/php-dot-net-ticks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243893849,"owners_count":20364918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["date","datetime","dot-net","dotnet","php","php-library","time"],"created_at":"2024-10-08T02:11:22.918Z","updated_at":"2025-10-24T08:43:44.538Z","avatar_url":"https://github.com/DivineOmega.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# ⏱ PHP .NET Ticks\n\n[![Build Status](https://travis-ci.org/DivineOmega/php-dot-net-ticks.svg?branch=master)](https://travis-ci.org/DivineOmega/php-dot-net-ticks)\n[![Coverage Status](https://coveralls.io/repos/github/DivineOmega/php-dot-net-ticks/badge.svg?branch=master)](https://coveralls.io/github/DivineOmega/php-dot-net-ticks?branch=master)\n[![StyleCI](https://styleci.io/repos/120622320/shield?branch=master)](https://styleci.io/repos/120622320)\n\nThis package helps PHP developers work with and convert .NET ticks, a form of precise time measurement used by the .NET `DateTime` object.\n\n## Features\n\nYou can use this library to do the following, and more.\n\n* Convert ticks to timestamp\n* Convert ticks to `DateTime` object\n* Convert ticks to `Carbon` date object\n* Get the current time in ticks\n* Convert timestamp to ticks\n\n## What are .NET ticks?\n\n\u003e A single tick represents one hundred nanoseconds or one ten-millionth of a second. There are 10,000 ticks in a millisecond, or 10 million ticks in a second. \n\n\u003e The value of this property [`DateTime.Ticks`] represents the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001 (0:00:00 UTC on January 1, 0001, in the Gregorian calendar), which represents DateTime.MinValue. It does not include the number of ticks that are attributable to leap seconds.\n\n*Source: [.NET API Reference: DateTime.Tick Property](https://msdn.microsoft.com/en-us/library/system.datetime.ticks(v=vs.110).aspx)*\n\n\n## Installation\n\nThe PHP .NET Ticks package can be easily installed using Composer. Just run the following command from the root of your project.\n\n```\ncomposer require divineomega/php-dot-net-ticks\n```\n\nIf you have never used the Composer dependency manager before, head to the [Composer website](https://getcomposer.org/) for more information on how to get started.\n\n## Usage\n\nFirst you need to create a new `Ticks` object. This can be done in several ways.\n\n```php\nuse DivineOmega\\DotNetTicks\\Ticks;\n\n// Current time\n$ticks = new Ticks();\n\n// Specific time in ticks\n$ticks = new Ticks(636536021491253348);\n\n// From timestamp\n$ticks = Ticks::createFromTimestamp(1518005349);\n```\n\nYou can then call methods on the `Ticks` object to retrieve or convert as necessary.\n\n```php\n$ticks = $ticks-\u003eticks();       // Ticks\n\n$time = $ticks-\u003etimestamp();    // UNIX timstamp\n\n$dateTime = $ticks-\u003edateTime(); // PHP DateTime object\n$carbon = $ticks-\u003ecarbon();     // Carbon date object\n```\n\nIf you wish, you can combine these two steps into one line, as shown in the examples below.\n\n```php\n// Get current time in ticks\n$nowInTicks = (new Ticks())-\u003eticks();\n\n// Convert ticks to timestamp\n$timestamp = (new Ticks(636536021491253348))-\u003etimestamp();\n\n// Convert timestamp to ticks\n$ticks = Ticks::createFromTimestamp(1518005349)-\u003eticks();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivineomega%2Fphp-dot-net-ticks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivineomega%2Fphp-dot-net-ticks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivineomega%2Fphp-dot-net-ticks/lists"}