あにす #7507(2008/08/31 19:19 GMT) [ C# ] Rating0/0=0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
using System; class Program { static void Main(string[] args) { Console.WriteLine( DateEx(Console.ReadLine(), long.Parse(Console.ReadLine())) ); Console.WriteLine( DateEx(long.Parse(Console.ReadLine())) ); Console.ReadLine(); } static string DateEx(string date, long addSeconds) { DateTime d; DateTime.TryParse(date, out d); if(d == null) throw new ArgumentException("日付が正しくありません。", "date"); return d.AddSeconds((double)addSeconds).ToString(); } static string DateEx(long addSeconds) { return DateEx(DateTime.Now.ToString(), addSeconds); } }
Rating0/0=0.00-0+
[ reply ]
あにす
#7507()
[
C#
]
Rating0/0=0.00
addSeconds = 40
> "2008/08/28 00:00:05"
Rating0/0=0.00-0+
[ reply ]