本文介绍了dd / Jan / 2012的日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中插入了所有记录。



数据库类型为

I inserted all the records in the database.

database type as

DOB             datetime
Wedding day     datetime



我有一个按钮视图,当我点击该按钮时,所有记录都应显示在网格视图中。



网格视图按钮代码如下:

SQL


I have a button view and when I click that button all records should be displayed in the Grid View.

Grid view Button code as follows:
SQL

Sql = "select Name,DOB,Mobileno,Weddingday,Email from BIrthDayWish where Active = 'A' ORDER BY Name";
        Dr = SCon.ReadSql(Sql);
        GridView1.DataSource = Dr;
        GridView1.DataBind();
        GridView1.Visible = true;


网格视图中的
输出如下


output in Grid View as follows

Name        DOB               Mobile no        Wedding day               Email
ram       22/12/1986          9945598565       22/12/2009            [email protected]



但我希望网格视图中与DOB和婚礼日期月相关的输出显示为char(Jan,Feb就像那样)


But I would like the output in the grid view related to DOB and Wedding day date month to be shown as in char (Jan,Feb like that)

DOB           Wedding
22/12/1986    22/12/2009 (I don't want like)



我希望它为


I want it as

DOB           Wedding
22/dec/1986    22/dec/2009 (I want like)




Name        DOB               Mobile no        Wedding day               Email
ram        22/dec/1986        9945598565        22/dec/2009            [email protected]



SQL


SQL

Sql = "select Name,DOB,Mobileno,Weddingday,Email from BIrthDayWish where Active = 'A' ORDER BY Name"



来自我的上述查询如何更正查询并获得如下输出


From my above query how to correct the query and get the output as follows

Name    DOB           Mobile no     Wedding day       Email
ram    22/dec/1986    9945598565     22/dec/2009    [email protected]

推荐答案

SELECT replace(convert(varchar(11), getdate(), 113),' ', '/')






or

SELECT replace(CONVERT(VARCHAR(11), GETDATE(), 106),' ', '/')



快乐编码!

:)


Happy Coding!
:)


这篇关于dd / Jan / 2012的日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 22:44