Formatting dates question.

g_r_a_robinson

Well-known member
Joined
Jan 13, 2004
Messages
71
Hi All

I am having problems with formatting a date into the UK format. I know that I can use

MyDate.ToString("dd/MM/yy")

but I need it to be kept in DateTime in order for me to compare them as dates.

For eg, when I get jobDueDate from my db its in the UK format. But when I use Convert.ToDateTime it changes the format to the USA format. Ive heard that globalisation has something to do this but I just want to keep it simple.

Here my code:

<code>

DataRowView drv = (DataRowView) e.Item.DataItem;
jobDueByDate = drv[JobData.DUE_DATE_FIELD].ToString();
jobCompleted = drv[JobData.COMPLETED_FIELD].ToString();

DateTime tmpDate = Convert.ToDateTime(jobDueByDate);

</code>
 
My regional settings are set to:

English(Australia)

and I live in Australia.

Although I brought this computer from the UK.
 
Back
Top