SSIS Script datetime conversion

  • Hi All

    Maybe very easy 1 this, On my PC I always have the regional settings, set to yyyy/mm/dd, now the SSIS pacakge might be run on a different PC as well, with regional settings set to maybe mm-dd-yyyy.

    In my script I want to rename a text file and then move it to the archive folder.

    If the reginal settings is set to the second version I'm going to land up with a file where the format is going to be "mmddyyyy file.txt"

    How can I ensure that the date will be in the yyyymmdd format, seeing that in SQL server I can use the convert function with parameter 121 but I cant seem to find anything for SSIS script component

    I'm using

    sDate = Replace(Convert.ToString(Today()), "/", "")

    to return the string of date

  • You could try playing around with custom date formats where you specify the format in code, eg

    Now.Date.ToString("yyyyMMdd")

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Thanks Phil!

    You are never to old to learn something new. I didnt even know about the now.date

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

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