Localized datetime question

  • Thread starter Thread starter Jon
  • Start date Start date
J

Jon

I am doing the following:
Me.lblDTCompleted.Text = DateTime.Parse(drTemp.Item(_DATECOMP)).ToString +
strTZ

where drTemp.Item(_DATECOMP) is datetime field in SQL server. I want to
display the date correctly formatted for the localized area, but without the
seconds displayed. Using the above correctly formats it, but leaves the
seconds on. How can I format it correctly for the region and remove the
seconds at the same time? I tried modifying my computer's regional settings
to not include seconds, but that did not work. Any solutions? Thanks!

Jon
 
Jon said:
Me.lblDTCompleted.Text = DateTime.Parse(drTemp.Item(_DATECOMP)).ToString +
strTZ

The conversions you are doing are not necessary:

\\\
Me.DTCompleted.Text = _
DirectCast(drTemp.Item(...), SqlDateTime).Value.ToString(<format
string>)
///
where drTemp.Item(_DATECOMP) is datetime field in SQL server. I want to
display the date correctly formatted for the localized area, but without
the seconds displayed. Using the above correctly formats it, but leaves
the seconds on. How can I format it correctly for the region and remove
the seconds at the same time? I tried modifying my computer's regional
settings to not include seconds, but that did not work.

Format strings:

Date and Time Format Strings
<URL:http://msdn.microsoft.com/library/en-us/cpguide/html/cpconDateTimeFormatStrings.asp>
 
Jon,

Without searching to an exact format, would I if the complete is not there
use a date format abriviation and concatinated to that a space and a string
format "hh:mm"

Just my thought,

Cor
 
Back
Top