0👍
When formatting DateTime.ToString()
you have to follow a specific format..
This article outlines the formatting characters..
Below shows how to convert DateTime
to string format from ticks
as well as a DateTime
object itself..
Run this example online via DotNetFiddle.net
using System;
namespace Root
{
public class Program
{
public static void Main()
{
/** could also do:
var nowInTicks = DateTime.Now.Ticks; */
var nowInTicks = 636905426867055839;
var nowString = new DateTime(nowInTicks).ToString("MM/dd/yyyy");
Console.WriteLine(nowString);
Console.WriteLine(DateTime.Now.ToString("MM/dd/yyyy hh:mm:sstt"));
}
}
}
/* RETURN: */
// 04/11/2019
// 04/11/2019 01:32:28AM // in UTC
- [Vuejs]-How can I insert or update a js-timestamp component after the page has loaded?
- [Vuejs]-Tranferring focus and clearing fields based on a barcode reading (VueJS)
Source:stackexchange.com