Date Manipulation in SSIS Script task or VB.Net

  • I am useing SSIS script task to compare dates from a file against the current date as represented by Datetime.Utcnow function. the file dates are in #dd/MM/yyyy hh:mm# format, When you view the value of the Datetime.Utcnow on quickwatch its date is in #MM/dd/yyyy hh:mm:ss# format. i want it to be in the UK format #dd/MM/yyyy hh:mm:ss#. thereby compatible with the format of the fdates from the file.

    Please find my code below. whatever i do the value still stays the same way

    Dim dDateToday As DateTime

    Dim s As [String] = DateTime.UtcNow.ToString()

    Dim cultureUK As IFormatProvider = New System.Globalization.CultureInfo("en-GB", True)

    If DateTime.TryParse(s, cultureUK, System.Globalization.DateTimeStyles.None, dDateToday) Then

    End If

    When i run the C# equivalent of the above code, it works fine unfortunately SSIS script task is VB.net. can anybody help please.

  • Can't you set the data type from the flat file to a Date data type and then do a direct date comparison instead of a string comparison?

  • If you can't do what Jack is suggesting, you can surely use the Data Conversion transformation to get your data in the correct type for comparison. You should not have code the comparisons.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

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

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