November 30, 2009 at 6:12 am
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.
November 30, 2009 at 7:37 am
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?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
November 30, 2009 at 4:01 pm
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.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy