Advertisement
G_Burlakova

DateFormat

Mar 18th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7.  
  8. class Exercise
  9. {
  10.     static void Main(string[] args)
  11.     {
  12.         Console.WriteLine("Enter date: ");
  13.         string dateStr = Console.ReadLine();
  14.         DateTime date;
  15.         bool dateCorrectFormat = DateTime.TryParse(dateStr, out date);
  16.         if (dateCorrectFormat)
  17.         {
  18.             Console.WriteLine(date.);
  19.         }
  20.         else
  21.         {
  22.             Console.WriteLine("Wrong format!");
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement