Click here to Skip to main content
15,889,874 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In one of my procedure , I am getting XML , Which have node , ProductName , DeliveryDate .

In my proceudre It parse the XML and insert into one table which having one NVARCHAR and one Datetime Column.

In the XML I am getting the date in format (2011-02-16T11:08:00+05:30)

Please let me know how can I convert it into (2011-02-16 11:08:00)

I have tried to replace the T and +05:30 with blank places ,
but everytime +5:30 is not constant.
Posted
Updated 18-Apr-11 21:17pm
v2

1 solution

It's good that you failed replacing +05:30 with blank spaces and too bad you tried.

This is the time zone. Without the time zone, you have the local time but loose the ability to order different events in time if they happen in different places of the globe. As you noticed +5:30 is not a constant, this is the case in your application.

You did not specify your platform, languages and the libraries you use, but in a nutshell, you need to transform all times into Coordinated Universal Time (UTC) http://en.wikipedia.org/wiki/Coordinated_Universal_Time[^] using the time zone information. Depending on your application, you may need need to store time zone information separately in your database, if you need to generate local time for your users. All modern calendar libraries have the features to accomplish it.

—SA
 
Share this answer
 
v3
Comments
Albin Abel 21-Mar-11 1:58am    
Correct answer. My 5
Sergey Alexandrovich Kryukov 21-Mar-11 3:03am    
Thank you very much.
--SA
bharath24 19-Apr-11 9:53am    
Thanx
Sergey Alexandrovich Kryukov 19-Apr-11 13:33pm    
You're very welcome.
Thanks for accepting this Solution.
Good luck, come again.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900