I have this code

Dim replace As String = System.DateTime.Now.AddDays(7).ToString("yyyy-MM-dd")

What I'm trying to do is

Dim replace As String = textbox1.text.AddDays(7).ToString("yyyy-MM-dd")

is there a way to use that add days from a text or string value already?

Recommended Answers

All 5 Replies

Are you wanting to do the following?

Dim thisDate As Date = #3/27/2010#
    Dim thisString As String = "3/27/2010"


    'Add 7 Days

    MsgBox(thisDate.AddDays(7).ToShortDateString)
    MsgBox(CDate(thisString).AddDays(7).ToShortDateString)
    
        Dim newString As String = thisDate.AddDays(7).ToShortDateString
    Label1.Text = newString

Are you wanting to do the following?

Dim thisDate As Date = #3/27/2010#
    Dim thisString As String = "3/27/2010"


    'Add 7 Days

    MsgBox(thisDate.AddDays(7).ToShortDateString)
    MsgBox(CDate(thisString).AddDays(7).ToShortDateString)
    
        Dim newString As String = thisDate.AddDays(7).ToShortDateString
    Label1.Text = newString

hmmm...something like that but, first I get the Label's date from my server (LAN CONNECTION) then the value through that date on the label is what I want to use the ADDDAYS

It doesn't matter how you get it as a string or a date type you just need to convert it to and from the type you want to use it as.

I think this will help you

Dim replace As String = CDate(textbox1.text).AddDays(7).ToString("yyyy-MM-dd")

I think this will help you

Dim replace As String = CDate(textbox1.text).AddDays(7).ToString("yyyy-MM-dd")

THANKS! that's what exactly I need

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.