Hi all,
Im have a problem here. Im using VWD 2008 (c#) and Mysql 2005. I dont know how to convert datetime data that i retrieve from mysql database to only date or time. Can anyone help me? Here is something that i tried to do.
- Date1.Text = Convert.ToString(reader["FunDateTime"], (MMMM d, yyyy));
-
//"MMMM d, yyyy",
-
Time1.Text = Convert.ToString(reader["FunTime"], (HH:mm ss tt));
-
//"HH:mm ss tt",
but it didnt work even when i try to put format in of reader.
Pls some one help me.
Regards,
Meshack
What data type is your FunTime column? DateTime?
If so you should try to retrieve it first into a DateTime object...then calling the ToString function on that.
(Please note that I'm really not great with C#, so there may be syntax errors in the following code...it's just there to give you an idea of what I'm talking about)
-
DateTime funTime = (DateTime) reader["FunTime"];
-
Time1.Text = funTime.ToString(HH:mm ss tt));
-
-Frinny