Converts a date to internet timestamp (TZ) format. - CSharp System

CSharp examples for System:DateTime Format

Description

Converts a date to internet timestamp (TZ) format.

Demo Code

//   Helpmebot is free software: you can redistribute it and/or modify
using System;/* w  w w.  j av a 2  s  . c om*/

public class Main{
        /// <summary>
        /// Converts a date to internet timestamp (TZ) format.
        /// </summary>
        /// <param name="date">
        /// The date.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public static string ToInternetFormat(this DateTime date)
        {
            return date.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ");
        }
}

Related Tutorials