转换日期格式有问题(; dd MMM yyyy;) [英] having problem converting date format (;dd MMM yyyy;)

查看:106
本文介绍了转换日期格式有问题(; dd MMM yyyy;)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从带有日期字段的ms sql中挑选数据和



想要这种格式(dd MMM yyyy);.



txtRunDate.Text = DateTime.Now.Date.ToString(dd MMM yyyy);





Picking data from ms sql with date field and

want it in this format ("dd MMM yyyy");.

txtRunDate.Text = DateTime.Now.Date.ToString("dd MMM yyyy");


table name :: trial   idno       variable(5)
                      date_trans datetime





怎么做我使用上面的格式获得 date_trans 字段





以上示例适用于当前日期。




如何使用date_trans字段代替Now来编码/>


txt_trans_Date = .......



how do i get the field date_trans using the format above


The example above is for the current date.


how do you code to get it using the field ' date_trans' in place of the 'Now'

txt_trans_Date= .......

推荐答案

你的问题有点令人困惑;但是你的意思是:
Your question is a bit confusing; but do you mean the following:
txtRunDate.Text = date_trans.Date.ToString("dd MMM yyyy");


你可以写

You can write
CONVERT(varchar(20),date_trans,106)



在您的选择查询中。然后你会得到dd MMM yyyy格式的日期


in your select query. then you will get the date in the format "dd MMM yyyy"


这篇关于转换日期格式有问题(; dd MMM yyyy;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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