The DateTime Ticks property simply returns a long that represents the amount of ticks (100-nanosecond interval) that have passed since january 1, 0001 12:00:00.
using System;
class Program
{
static void Main()
{
DateTime variable = DateTime.Now;
long ticks = variable.Ticks;
Console.WriteLine(ticks);
Console.Read();
}
}
output:633117518171562500
Convery Ticks Back to DateTime
Now that we have converted a DateTime object to a Ticks now we have to learn how to convert is back to a DateTime value.
using System;
class Program
{
static void Main()
{
long ticks = 633117518171562500;
DateTime date = new DateTime(ticks);
Console.WriteLine(date.ToString());
Console.Read();
}
}
Output: 4/9/2007 9:43:37 PM
Subscribe to:
Post Comments (Atom)
Table Partitioning in SQL Server
Table Partitioning in SQL Server – Step by Step Partitioning in SQL Server task is divided into four steps: Create a File Group Add Files ...

-
Global .asax file- <%@ Application Language = "C#" %> <script runat= "server" > void...
-
Table Partitioning in SQL Server – Step by Step Partitioning in SQL Server task is divided into four steps: Create a File Group Add Files ...
-
//Convert image in byte and show image................... protected void Upload_Click(object sender, EventArgs e) { try ...
No comments:
Post a Comment