![]() | |
![]() |
| | Thread Tools | Display Modes |
#21
| |||
| |||
|
|
Thanks Lonnye. I used a PHP program to convert the string to a format in the book. It was successful. But how do I handle the timezone?America/Los_Angeles I need to have UTC date. Is there a function to convert the date according to the timezone value? "lonnye" wrote: Check out books online and look at the convert function. It's syntax is CONVERT ( data_type [ ( length ) ] , expression [ , style ] ). I dont have access to a sql server at this moment, but I would imagine doing something like: If Fri Feb 29 16:46:39 America/Los_Angeles 2008 were in a colum named the_date... declare @date_st varchar(30) set @date_st = substring(5, 7, the_date) + substring(41, 4, the_date) + substring(11,9, the_date) convert(datetime, @date_st) This is just off the top of my head so I apologize if anythign is wrong - what I did was pull the Feb 29, add the 2008, then add the time part... and convert that to datetime. Hope this helps. -- ~lb "Pingx" wrote: Fri Feb 29 16:46:39 America/Los_Angeles 2008 Hi, I'd like to know how I can convert the above string to a date. Thanks in advance. Pingx |
#22
| |||
| |||
|
|
Thanks Lonnye. I used a PHP program to convert the string to a format in the book. It was successful. But how do I handle the timezone?America/Los_Angeles I need to have UTC date. Is there a function to convert the date according to the timezone value? "lonnye" wrote: Check out books online and look at the convert function. It's syntax is CONVERT ( data_type [ ( length ) ] , expression [ , style ] ). I dont have access to a sql server at this moment, but I would imagine doing something like: If Fri Feb 29 16:46:39 America/Los_Angeles 2008 were in a colum named the_date... declare @date_st varchar(30) set @date_st = substring(5, 7, the_date) + substring(41, 4, the_date) + substring(11,9, the_date) convert(datetime, @date_st) This is just off the top of my head so I apologize if anythign is wrong - what I did was pull the Feb 29, add the 2008, then add the time part... and convert that to datetime. Hope this helps. -- ~lb "Pingx" wrote: Fri Feb 29 16:46:39 America/Los_Angeles 2008 Hi, I'd like to know how I can convert the above string to a date. Thanks in advance. Pingx |
#23
| |||
| |||
|
|
Thanks Lonnye. I used a PHP program to convert the string to a format in the book. It was successful. But how do I handle the timezone?America/Los_Angeles I need to have UTC date. Is there a function to convert the date according to the timezone value? "lonnye" wrote: Check out books online and look at the convert function. It's syntax is CONVERT ( data_type [ ( length ) ] , expression [ , style ] ). I dont have access to a sql server at this moment, but I would imagine doing something like: If Fri Feb 29 16:46:39 America/Los_Angeles 2008 were in a colum named the_date... declare @date_st varchar(30) set @date_st = substring(5, 7, the_date) + substring(41, 4, the_date) + substring(11,9, the_date) convert(datetime, @date_st) This is just off the top of my head so I apologize if anythign is wrong - what I did was pull the Feb 29, add the 2008, then add the time part... and convert that to datetime. Hope this helps. -- ~lb "Pingx" wrote: Fri Feb 29 16:46:39 America/Los_Angeles 2008 Hi, I'd like to know how I can convert the above string to a date. Thanks in advance. Pingx |
#24
| |||
| |||
|
|
Thanks Lonnye. I used a PHP program to convert the string to a format in the book. It was successful. But how do I handle the timezone?America/Los_Angeles I need to have UTC date. Is there a function to convert the date according to the timezone value? "lonnye" wrote: Check out books online and look at the convert function. It's syntax is CONVERT ( data_type [ ( length ) ] , expression [ , style ] ). I dont have access to a sql server at this moment, but I would imagine doing something like: If Fri Feb 29 16:46:39 America/Los_Angeles 2008 were in a colum named the_date... declare @date_st varchar(30) set @date_st = substring(5, 7, the_date) + substring(41, 4, the_date) + substring(11,9, the_date) convert(datetime, @date_st) This is just off the top of my head so I apologize if anythign is wrong - what I did was pull the Feb 29, add the 2008, then add the time part... and convert that to datetime. Hope this helps. -- ~lb "Pingx" wrote: Fri Feb 29 16:46:39 America/Los_Angeles 2008 Hi, I'd like to know how I can convert the above string to a date. Thanks in advance. Pingx |
#25
| |||
| |||
|
|
Thanks Lonnye. I used a PHP program to convert the string to a format in the book. It was successful. But how do I handle the timezone?America/Los_Angeles I need to have UTC date. Is there a function to convert the date according to the timezone value? "lonnye" wrote: Check out books online and look at the convert function. It's syntax is CONVERT ( data_type [ ( length ) ] , expression [ , style ] ). I dont have access to a sql server at this moment, but I would imagine doing something like: If Fri Feb 29 16:46:39 America/Los_Angeles 2008 were in a colum named the_date... declare @date_st varchar(30) set @date_st = substring(5, 7, the_date) + substring(41, 4, the_date) + substring(11,9, the_date) convert(datetime, @date_st) This is just off the top of my head so I apologize if anythign is wrong - what I did was pull the Feb 29, add the 2008, then add the time part... and convert that to datetime. Hope this helps. -- ~lb "Pingx" wrote: Fri Feb 29 16:46:39 America/Los_Angeles 2008 Hi, I'd like to know how I can convert the above string to a date. Thanks in advance. Pingx |
![]() |
| Thread Tools | |
| Display Modes | |
| |