是否可以在string.Format中添加+1小时 [英] Is it possible to add +1 hour to string.Format
本文介绍了是否可以在string.Format中添加+1小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用此代码时是否可以为Starttid和Sluttid添加1小时,如果是,我该怎么做?
string .Format( Hej,Rubrik: {0} Starttid:{1} Sluttid:{2:} Beskrivning:{3}Mötetborokav:{4},Rubrik,Starttid,Sluttid,Beskrivning,LoginName)
解决方案
如果Starttid
和Sluttid
是DateTime数据类型,你可以使用 AddHours()方法 [ ^ ]。
Is it possible to add 1 hour to Starttid and Sluttid when using this code, if it is, how do i do that?
string.Format("Hej, Rubrik : {0} Starttid : {1} Sluttid : {2:} Beskrivning : {3} Mötet bokat av: {4}", Rubrik, Starttid, Sluttid, Beskrivning, LoginName)
解决方案
IfStarttid
andSluttid
is DateTime datatype, you can use AddHours() method[^].
这篇关于是否可以在string.Format中添加+1小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文