format date time to string dd/MM/yyyy

  • Thread starter Thread starter airwalker2000
  • Start date Start date
A

airwalker2000

Guest
Hi,

I am trying to format a string that converted from a DateTime into a dd/MM/yyyy format, however my string is being displayed as a full datetime

what I want is 09/06/2014

but what I get is 09/06/2014 11:32:12

Here is the code I am using

foreach (DataRow row in dataSource.Rows)
{
if (row["PRD_TYPE"].ToString() == "Online")
{
DateTime time = DateTime.Now;
time = DateTime.Now;
string test = time.ToString("dd/MM/yyyy");

string ComputeStartDate = time.ToString("dd/MM/yyyy");
string ComputeEndDate = time.AddYears(1).ToString("dd/MM/yyyy");

row["SES_DATE"] = ComputeStartDate;
row["SES_ENDDATE"] = ComputeEndDate;

}
}

Continue reading...
 
Back
Top