using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CarGallery
{

    // ye seri class ha darim be name Static
    // in class ha vase estefade az etela ateshoon niaz nist barashoon Instance besazim !

    public static class DateAndTime
    {

        static string year, month, day, hour, minute, second;

        static void calculate() // miad tarikh o zaman ro mohasebe mikone
        {

            // aval be soorate zir sal,mah,rooz , sa at , daqiqe va sanie ro migire
            year = DateTime.Now.Year.ToString();
            month = DateTime.Now.Month.ToString();
            day = DateTime.Now.Day.ToString();

            hour = DateTime.Now.Hour.ToString();
            minute = DateTime.Now.Minute.ToString();
            second = DateTime.Now.Second.ToString();


            // bad miad normalize mikonim. yani masalan age sa at 9:15 bood behemoon 09:15 mide ya age 2 o 5 daqiqe bood mishe 02:05

            if (month.Length == 1)
                month = "0" + month;

            if (day.Length == 1)
                day = "0" + day;

            if (hour.Length == 1)
                hour = "0" + hour;

            if (minute.Length == 1)
                minute = "0" + minute;

            if (second.Length == 1)
                second = "0" + second;
        }


        //in method ham miad tarikh va zaman ro barmigardoone be soorate ye reshte masalan 20160217091215
		// estefadash ham be onvane ID e comment va ID e post
		
        public static string getID()
        {
            calculate();
            return year + month + day + hour + minute + second;
        }
    }
}