---
title: "What is a basic concept of date and time"  
description: "What is a basic concept of date and time"  
author: "Ailsa Singh"  
published: 2016-09-14  
updated: 2016-09-14  
canonical: https://www.mindstick.com/forum/34177/what-is-a-basic-concept-of-date-and-time  
category: "c#"  
tags: ["c#"]  
reading_time: 3 minutes  

---

# What is a basic concept of date and time

I am implementing a [project](https://www.mindstick.com/articles/105927/how-to-excel-at-managing-multiple-projects) on c# [programming language](https://www.mindstick.com/articles/329035/5-most-in-demand-programming-languages-to-consider-for-your-app-development-in-2022).I want to include [date](https://yourviews.mindstick.com/story/3869/propose-day-2024-exciting-date-ideas-for-you-and-your-partner) and time in project.please help me.I would really appreciate your help.\
Thanks

## Replies

### Reply by Elena Glibart

Here is a basic concept of data and time

* DateTime is the class which is already defined in the system.

* General format of the date is Year month and day.

```
                   For example: DateTime Date1 = new DateTime(2014, 02, 01);
```

In the above example below are the input which is already define by the programmer:

Year : 2014

Month: (02) February

Day : 01

\
* Representation of the date:

Programmer can represent the date in his/her own format by keeping the basic format in their mind

MMMM (in caps):- full name of the month. eg September

MMM (in caps):- short name of the month. eg. Sept

MM (in caps):- Month in number

dddd (without caps) :- full name of the day. eg Saturday

ddd (without caps) :- short name of the day. eg. Sat

dd (without caps) :- day in number

yyy & yyyy (without caps) means : represent year. ex. 2014

yy (without caps) : represent last two alphabet of the year. ex for 2014 it will represent 14.

*In formatting operations, custom date and time format strings can be used either with the ToString method of a date and time instance or with a method that supports composite formatting.

**** Syntax for the programmer to represent date in his/her own format.***

```
Console.WriteLine("Today is " +Date1.ToString("ddd yy, MMMM") );
```

* DateTimeOffset is the class which is used for both date & time.

* General format of the date is Year, Month, Day, Hour, Minute, Second & timespan.

For example DateTimeOffset Date2 = new DateTimeOffset(2011, 6, 10, 15, 24, 16,

TimeSpan.Zero);

\
*Programmer can represent the date in his/her own format by keeping the basic format in their mind

```
H: Hourmm:Minutess : Second zzz : TimeSpan  
```

**** Syntax for the programmer to represent date & time in his/her own format***

```
Console.WriteLine (" date and time:{0:MM/dd/yy H:mm:ss zzz}",                    Date2);
```

***Here is the complete program to implement the date and time logic :***

```
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; namespace ConsoleApplication12{    class Program    {        static void Main(string[] args)        {             DateTime date1 = new DateTime(2016,09,14);// year
month and day             Console.WriteLine("Today is
" + date1.ToString("ddd yy, MMMM"));             DateTimeOffset Date2 = new DateTimeOffset(2016,09,14, 15, 24, 16, new TimeSpan(1,0,0));                                                     Console.WriteLine(" date and
time: {0:MM/dd/yy H:mm:ss zzz}",
Date2);            Console.ReadLine();         }    }}   
```


---

Original Source: https://www.mindstick.com/forum/34177/what-is-a-basic-concept-of-date-and-time

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
