Date conversion

  • Am trying to write a Active X vbscript which takes a date in the string format of ddmmyy and converts it to a datetime type of dd/mm/yyyy. ie 270399 -> 27/03/1999.  Any help would be appreciated

  • Try something like this:

     

    dim thisDate

    thisDate = now()

    dim formattedDate

    formattedDate = datePart("d",ThisDate) & "/" & datePart("m",ThisDate)

    formattedDate = formattedDate & "/" & datePart("yyyy",ThisDate)

    Aunt Kathi Data Platform MVP
    Author of Expert T-SQL Window Functions
    Simple-Talk Editor

  • You're doing this in a DTS transformation step ??

    If so, I've had success converting dates a different way.

    When creating a "New Transformation", choose "DateTime String" , then "Properties". Then you get pull-down selections of how your source data is formatted and how you want your destination data to be formatted.

    Sorry if this is off-topic.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply