Reputation: 417
I created variable with datatype datetime in ssis.
by default it come with dd/mm/yyyy hh:mm:ss
format.
How can I convert a date from dd/mm/yyyy hh:mm:ss
format to dd-mm-yyyy hh:mm:ss
format in datetime
variable.
Ex:
Variable is: 05/12/2018 18:14:03
Output should be
05-12-2018 18:14:03
Upvotes: 0
Views: 1514
Reputation: 4169
Okay so I beleive from the comments of the other answer you may have a misunderstanding of what's happening here.
In both SQLServer and SSIS DATETIME
is just simply a data type and is stored as such. Now when you are querying those columns from your table in the database on two different servers that have different settings for how they should display that data you'll get dd/mm/yyyy hh:mm:ss
or dd-mm-yyyy hh:mm:ss
depending on your region settings. However this DOES NOT mean that SQL Server or SSIS is storing those values in that format. It's just defaulted to display that way.
Now if you need to change how that column is DIPSLAYED when you query the table you can see a list of conversions that may help you on this ugly looking website.
Upvotes: 0
Reputation: 31785
You don't convert the formats of datetime
variables. You can only give it a format when converting it to a string.
Upvotes: 2