Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Run Embedded C# Pad on a web page
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Embedded C# Pad code example</title>
</head>
<body>
<pre>
<code class="codepad language-csharp" data-codepad="theme:cobalt" style="width:100%;height:400px;" >//
// This program shows how long ago C# Pad (http://www.csharppad.com) was released.
// This source: http://jsbin.com/pukabidogi/edit?html,output
var releaseDate = new DateTime(2014, 2, 26, 6, 15, 0, DateTimeKind.Utc);
var span = DateTime.UtcNow - releaseDate;
Console.WriteLine("");
Console.WriteLine("It's been {0} years, {1} months, {2} days, {3} hours, {4} minutes, {5} seconds since C# Pad was released!",
Math.Floor(span.Days / 365.25f), Math.Floor((span.Days % 365.25f) / 30f), (span.Days % 365.25f) % 30f, span.Hours, span.Minutes, span.Seconds )
</code>
</pre>
<script src="//csharppad.com/embed.js"></script>
<script type="text/javascript"> Codepad.all(); </script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.