Skip to content

Instantly share code, notes, and snippets.

View buchizo's full-sized avatar
🍤
( ´・ω・)つΣ;:',;',',:'',:',;',',)

kosmos.ebi buchizo

🍤
( ´・ω・)つΣ;:',;',',:'',:',;',',)
View GitHub Profile
using System;
using System.Text.RegularExpressions;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
// http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html
@buchizo
buchizo / gist:2650720
Created May 10, 2012 02:55
Convert to DateTimeOffset from Json Date(Unix epoch)
/// <summary>
/// Convert to DateTimeOffset from Json Date(Unix epoch)
/// </summary>
/// <param name="jsondate">ex: "/Date(1324707957994+0900)/"</param>
/// <returns></returns>
public Nullable<DateTimeOffset> ConvertToDateTimeOffsetFromJsonDate(string jsondate)
{
if (String.IsNullOrEmpty(jsondate)) return null;
Regex regex = new System.Text.RegularExpressions.Regex(@"^\/date\((\d*)([\+\-]?\d*)\)\/+$");