2 Replies - 9601 Views - Last Post: 27 April 2010 - 04:56 PM Rate Topic: -----

#1 vennesschan   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 112
  • Joined: 20-April 10

Convert datetime to "MM/dd/yyyy"

Posted 27 April 2010 - 03:27 PM

Hi,

Can someone provide an example how can I have a listview subitem convert from datetime to the format of "MM/dd/yyyy"

I have wrote the following codes, but it didn't work out on that way. :(

ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(reader("Date").ToString("MM/dd/yyyy"))



Is This A Good Question/Topic? 0
  • +

Replies To: Convert datetime to "MM/dd/yyyy"

#2 CharlieMay   User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1734
  • View blog
  • Posts: 5,710
  • Joined: 25-September 09

Re: Convert datetime to "MM/dd/yyyy"

Posted 27 April 2010 - 03:59 PM

I think that reader("Date") isn't actually a date so try .Add(CDate(Reader("Date")).ToString("MM/dd/yyyy"))

This post has been edited by CharlieMay: 27 April 2010 - 03:59 PM

Was This Post Helpful? 1
  • +
  • -

#3 vennesschan   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 112
  • Joined: 20-April 10

Re: Convert datetime to "MM/dd/yyyy"

Posted 27 April 2010 - 04:56 PM

How could you tell it is not a Date? :)

If I want to do some calculation on the following codes, can I use CDbl("0.00") to round up the decimal place?

SubItems.Add((reader("High").ToString) - (reader("Low").ToString))


This post has been edited by vennesschan: 27 April 2010 - 05:00 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1