0
Dim mDocDtT As Date
Dim mDtPeriod as Integer = 4
mDocDtT = DateAdd(DateInterval.Month, mDtPeriod, mDocDtT)
mDocDtT = Format(mDocDtT, "yyyy-MM-dd")

But the codes are not working the date is still in #01/27/2011# format
I want it in yyyy-MM-dd format

Please help!!!

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by debayanmitra
0

Format returns a string.

To have a string in the format you want: Assign it to a string.

Dim mDocDtT As Date
    Dim mDtPeriod As Integer = 4
    mDocDtT = DateAdd(DateInterval.Month, mDtPeriod, mDocDtT)
    Dim dateString As String = Format(mDocDtT, "yyyy-MM-dd")
    MsgBox(dateString)

If this solves your problem mark it as solved. If not, say why it didn't solve your problem.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.