date format
How does one remove or avoid the time part from a date/time field value. For example stored in database as 9/15/2012 11:36:06 AM ,but we have to retrive in label as 15/9/2012 only from table....
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kunal VaishyaPosted Jul 5, 2012, 4:23 AM
you get all different type of format
but you get it in varchar you can set in label for display purpose
Select convert (varchar ,date,111) from category
Or
Select convert (Varchar ,GetDate(),111)
you will get
2012/07/05
Or
Select convert (Varchar ,GetDate(),101)
Out Put Get :07/05/2012
Select convert (Varchar ,GetDate(),102)
Out Put Get :2012.07.05
Select convert (Varchar ,GetDate(),103)
05/07/2012
Select convert (Varchar ,GetDate(),104
05.07.2012
Select convert (Varchar ,GetDate(),105)
05-07-2012
Set As Per Requirement
sudharsan sPosted Jul 5, 2012, 3:03 AM
select convert (varchar(10),created_date,111) from category
created_date=== your database datetime column name
category==== category is table name
replace this as per your database and try.
additinal info:
111=== indicate the date format
Manikavelu VelayuthamPosted Jul 5, 2012, 2:59 AM
YOu can dispaly the date value in any format by converting to string using formats available in the above link.