将datetime转换为yyyy

将datetime转换为yyyy

本文介绍了将datetime转换为yyyy / MM / dd格式。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[荒谬]



大家好,

i想转换datetime.now格式化yyyy / MM / dd但转换后的格式也应该是在datetime,不在字符串。这是我不想要string.format方法,因为它会将datetime作为string.i想要返回datetime.Any help?

[Absurdity]

Hello everyone,
i want to convert datetime.now to format yyyy/MM/dd but the converted format should also be in datetime,not in string.that is i dont want string.format method as it will return datetime as string.i want as datetime.Any help?

推荐答案

string dtime = DateTime.Now.ToString("yyyy/MM/dd");



你肯定会得到你想要的日期格式。


you'll sure get your desire date format.



这篇关于将datetime转换为yyyy / MM / dd格式。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 19:47