Date problem
-
Hi, I am allowing user to select datetime in datetimepicker in "dd/MM/yyyy" format but when it stores in sqlserver 2005 it store as "mm/DD/yyyy", but i want it store as "dd/MM/yyyy" format in SqlServer 2005, how can i do that OR When i filter records, it should be in "dd/MM/yyyy" format ? Regards, XYZ
-
Hi, I am allowing user to select datetime in datetimepicker in "dd/MM/yyyy" format but when it stores in sqlserver 2005 it store as "mm/DD/yyyy", but i want it store as "dd/MM/yyyy" format in SqlServer 2005, how can i do that OR When i filter records, it should be in "dd/MM/yyyy" format ? Regards, XYZ
The internal format used to store a date time has nothing to do with how it is serialized as a string. Both SQL and C# have techniques for serializing date/times. In particular, you'll want to look into DATEPART and CONVERT for SQL and ToString and String.Format for C#. The C# DateTime also has several methods that allow you to serialize to different common formats.
-
The internal format used to store a date time has nothing to do with how it is serialized as a string. Both SQL and C# have techniques for serializing date/times. In particular, you'll want to look into DATEPART and CONVERT for SQL and ToString and String.Format for C#. The C# DateTime also has several methods that allow you to serialize to different common formats.
Write in SQL Select Query Select Convert(varchar(10),getdate(),103) Like this will return dd-MM-yyyy And in C# use .ToString("dd-MM-yyyy"); In grid use DataFormatString Property and make sure HTMLEncode="False" set in That column
Best Regards, Chetan Patel
-
Write in SQL Select Query Select Convert(varchar(10),getdate(),103) Like this will return dd-MM-yyyy And in C# use .ToString("dd-MM-yyyy"); In grid use DataFormatString Property and make sure HTMLEncode="False" set in That column
Best Regards, Chetan Patel
I already know how to do that... you might want to reply to the OP to tell him/her what you've told me. Though, to be honest, I think I gave him/her enough information already.
-
Hi, I am allowing user to select datetime in datetimepicker in "dd/MM/yyyy" format but when it stores in sqlserver 2005 it store as "mm/DD/yyyy", but i want it store as "dd/MM/yyyy" format in SqlServer 2005, how can i do that OR When i filter records, it should be in "dd/MM/yyyy" format ? Regards, XYZ
you might want to read this[^]. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.