如何传递日期时间作为参数 [英] how to pass datetime as parameter

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

问题描述

我有显示系统时间的标签,我想将其作为参数传递
我有以下方法
int abc = blu.insertLogintime();

我需要传递的参数是保存系统时间的标签
请提供代码帮助
关于bishnu karki

i have label which shows the system time and i want to pass it as parameter
i have the following method
int abc = blu.insertLogintime();

the parameter which i need to pass is label which holds the system time
please help with the code
with regards bishnu karki

推荐答案

取决于您要将其作为以下内容传递的方式:
Depends on what you want to pass it as:
public int insertLoginTime(DateTime dt)

然后您需要在Label.Text属性上使用DateTime.Parse,DateTime.ParseExact或DateTime.TryParse.

Then you need to use DateTime.Parse, DateTime.ParseExact otr DateTime.TryParse on the Label.Text property.

public int insertLoginTime(string s)

,那么您需要将其传递给Label.Text属性.

Then you need to pass it the Label.Text property.

public int insertLoginTime(Label l)

然后您需要传递标签本身.

Then you need to pass it the Label itself.


这篇关于如何传递日期时间作为参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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