textbox - date formatting issue RRS feed

  • Question

  • if you have a textbox and I need to take
    Dim rentaldate as date = now
    dim rentreturndate as date

    how do you get a format of "Sunday,     01, 01, 2009"

    all I get is 01/01/2009 and time

    I also need to be able to add a certain number of days to date now before formatting.
    Sunday, June 7, 2009 11:11 PM


  • DateTime dtFormattedNowDate = DateTime.Now.AddDays(2);  //Adding 2 days to DateTime.Now.
    // Formatting the date- "dtFormattedNowDate" to  the format -"Sunday, 01, 01, 2009"
    string dtFormattedDate = String.Format("{0:dddd, MM, dd, yyyy}", dtFormattedNowDate);  

    Above is the code in C#. I am not into VB. Hope, you can convert it into appropriate VB.


    However, please find the VB to C# conversion that I did from online conversion tool:

    Dim dtFormattedNowDate As DateTime = DateTime.Now.AddDays(2) 
    'Adding 2 days to DateTime: Now. 
    ' Formatting the date- "dtFormattedNowDate" to the format -"Sunday, 01, 01, 2009" 
    Dim dtFormattedDate As String = [String].Format("{0:dddd, MM, dd, yyyy}", dtFormattedNowDate) 

    Regards, Lakra :) - If the post is helpful or answers your question, please mark it as such.
    Monday, June 8, 2009 9:05 AM