Im trying to put current system time in YYMMDD format but having problem with day function.
is Day() which returned day of month in VB6 not available in VB.Net?
If I want to get the current day of month, how would I do that?

Dim dt As Date
Dim dtString As String

dtString = Year(now()) + Month(now()) + Day(now())

Recommended Answers

All 3 Replies

See If this helps.

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        MsgBox(xDate)
        MsgBox(xDate("dd"))
    End Sub
    Private Function xDate(Optional ByVal selDateFormat As String = "MM.dd.yyyy") As String
        Return Date.Now.ToString(selDateFormat)
    End Function

Im trying to put current system time in YYMMDD format but having problem with day function.
is Day() which returned day of month in VB6 not available in VB.Net?
If I want to get the current day of month, how would I do that?

Dim dt As Date
Dim dtString As String

dtString = Year(now()) + Month(now()) + Day(now())

Use the below code so that u can get the system date

Dim d As String = Format(Today, "yy/MM/dd")
TextBox1.Text = d
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.