Reputation: 167
i have two Datetimepicker. One is formatted as Date, and the other one is formatted as Time. Now i have database which have 3 columns: ID, Name, and Schedule. I want to save the date and time in the schedule column formatted like this mm/dd/yyyy hh:mm AM/PM
What datatype should i use in schedule column?
Upvotes: 0
Views: 61
Reputation: 60
Combining (concatenating) date and time into a datetime
using System;
using System.Globalization;
public class Test
{
public static void Main()
{
string one = "13/02/09";
string two = "2:35:10 PM";
DateTime dt = Convert.ToDateTime(one + " " + two);
DateTime dt1 = DateTime.ParseExact(one + " " + two, "dd/MM/yy h:mm:ss tt", CultureInfo.InvariantCulture);
Console.WriteLine(dt1);
}
}
Upvotes: 0