Date to string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sam12
    New Member
    • Apr 2008
    • 16

    Date to string

    Hi everyone,

    I am new in ASP
    I want to create a string with current date+ "1/2/3" year(s )
    if mm/dd/yyyy is current date
    i want to add a "variable" in yyyy , variable is a combo box values.. (1,2,3)
    And then i want a string like "mmddyyyy"
    Thanks
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Originally posted by sam12
    Hi everyone,

    I am new in ASP
    I want to create a string with current date+ "1/2/3" year(s )
    if mm/dd/yyyy is current date
    i want to add a "variable" in yyyy , variable is a combo box values.. (1,2,3)
    And then i want a string like "mmddyyyy"
    Thanks
    Hi Sam,

    All data that comes from a form (so a combo box, for example) is in string format - it would have to be converted to a date in order to be used as such and there is no need to convert it to a string. So if you had a form like this:
    Code:
    <select name="monthPart"><option value="01">01, Jan</option>
    <option value="02">02, Feb</option>
    <option value="03">03, Mar</option>
    <option value="04">04, Apr</option></select>
    
    <select name="dayPart"><option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option></select>
    
    <select name="yearPart"><option value="2006">2006</option>
    <option value="2007">2007</option>
    <option value="2008">2008</option>
    <option value="2009">2009</option></select>
    then you could form your strings like this:
    Code:
    dim fullDate, yearPartOnly
    fullDate = request("monthPart") & "/" & request("dayPart") & "/" & request("yearPart")
    yearPartOnly = request("yearPart")
    Is this what you are looking for?

    Jared

    Comment

    Working...