Advertisement
Guest User

C# Part2 Strings 17 by vphilipov

a guest
Feb 2nd, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. using System.Globalization;
  3.  
  4. /*
  5.  * Write a program that reads a date and time given in the format: day.month.year
  6.  * hour:minute:second and prints the date and time after 6 hours and 30 minutes
  7.  * (in the same format) along with the day of week in Bulgarian.
  8.  */
  9.  
  10. namespace ReadDateTimeAddHoursPrint
  11. {
  12.     class ReadDateTimeAddHoursPrint
  13.     {
  14.         static void Main()
  15.         {
  16.             Console.WriteLine("Please enter the date and time (dd.mm.yyyy hh:mm:ss): ");
  17.             DateTime date = DateTime.ParseExact(Console.ReadLine(), "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture);
  18.             date = date.AddHours(6.5);
  19.             System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("bg-BG");
  20.             Console.WriteLine(date + " " + date.DayOfWeek);
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement