如何仅从日期时间显示日期. [英] How to dispaly date only from datetime.

查看:86
本文介绍了如何仅从日期时间显示日期.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个带有一个datetime数据类型列的数据表,我要在该列中仅显示date.

请帮我实现它.

Hai all,

I have one datatable with one datetime datatype column, what i want to do is in that column i have to be displayed date only .

Please help me how to attain it.

推荐答案

string str = DateTime.Now.ToString("dd MMM yyyy");


u只想为想要显示的用户显示日期和时间,对吗...

如果是这样

在获取日期的同时执行此操作
u want to store both date and time while displaying for the user you want date only ...is it right?

if so

while getting the date do this
select convert(varchar,DATE,103) from tablename


您只需要在SQL表列的右侧显示日期?

但是当你给数据类型"DateTime".默认情况下,您的时间将附加日期. (12:00:00 AM)
将列数据类型也更改为Varchar.
you have to display only date in SQL table column right ?

but as u give datatype "DateTime". bydefault your time will append with date. (12:00:00AM)
change column datatype to Varchar either.


这篇关于如何仅从日期时间显示日期.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆