Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tyekhan786
Starting Member
9 Posts |
Posted - 2014-03-31 : 02:29:35
|
I have a Date& time field as below26/03/2014 16:41:02but i need to add to letters in it as show below,26/03/2014T16:41:02ZThanks |
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2014-03-31 : 02:43:18
|
[code]declare @dtDate as datetimeset @dtDate='2014/03/26 16:41:02'select convert(varchar(10),@dtDate,103)+'T '+convert(varchar(15),@dtDate,108)+'Z'[/code]output:[code]26/03/2014T 16:41:02Z[/code]SsabinWeb MCP |
|
|
tyekhan786
Starting Member
9 Posts |
Posted - 2014-03-31 : 08:08:35
|
Thanks the below only works for 1 date, in the table i have different date & time, i just need the datetime to be in the below format YYYY-MM-DDTHH:MM:SSZ Current format is YYYY-MM-DD HH:MM:SSquote: Originally posted by stepson
declare @dtDate as datetimeset @dtDate='2014/03/26 16:41:02'select convert(varchar(10),@dtDate,103)+'T '+convert(varchar(15),@dtDate,108)+'Z' output:26/03/2014T 16:41:02Z SsabinWeb MCP
|
|
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2014-03-31 : 08:45:36
|
SELECT convert(varchar(10),YourColumn,103)+'T'+convert(varchar(15),YourColumn,108)+'Z'FROM YourTablesabinWeb MCP |
|
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2014-03-31 : 09:09:48
|
SELECT convert(varchar(30),YourColumn,127)FROM YourTablesabinWeb MCP |
|
|
|
|
|
|
|