Link to home
Start Free TrialLog in
Avatar of ziorrinfotech
ziorrinfotech

asked on

formating string to currency and datetime

I am reading values from a datatable.
and I want to format the Date to 6/5/2010
and decimal number to $ 100,000.00

how can i do this

This is my code
 If _propertyDetailDataSet.Tables("Property").Rows(0)("DeedRecordingDate") IsNot DBNull.Value And
            CType(_propertyDetailDataSet.Tables("Property").Rows(0)("DeedRecordingDate"), String) <> "1/1/1900" Then

            deedRecordingDateValueLabel.Text = CType(_propertyDetailDataSet.Tables("Property").Rows(0)("DeedRecordingDate"), String)
        End If
        buyInPriceValueLabel.Text = "$" & CType(_propertyDetailDataSet.Tables("PropertyProposed").Rows(0)("BuyInPrice"), String)
ASKER CERTIFIED SOLUTION
Avatar of masterpass
masterpass
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Shahan Ayyub
Have a look at this also:

For Date:      
        Dim Inputdate As DateTime = Convert.ToDateTime("6-5-2010")
        Dim FormattedDate As String = Inputdate.ToString("MM/dd/yyyy")

For Amount:
        Dim InputAmt As String = "$ 10000000000"
        Dim Amount As Double = Double.Parse(InputAmt.Replace("$ ", ""))
        Dim deciPart As String = String.Format("{0:#\.##}", Amount)
        Dim IntPart As Integer = String.Format("{0:#\.##}", Amount)
        Dim revenue As String = IntPart.ToString("###,##")
        revenue = "$" + revenue + "." + deciPart.Split(".")(1).ToString()