仅显示前一个日期,而不显示当前和将来的日期. [英] only the previous date has to be shown and not the present and future date..

查看:81
本文介绍了仅显示前一个日期,而不显示当前和将来的日期.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

手动输入日期...我输入的日期应该是以前的日期,而不应该是现在或将来的日期..如果我输入当前或将来的日期,则应该抛出错误..请帮助用代码给我...这是一个移动Web应用程序.我不使用日期和时间选择器,而是使用文本框

manually i am entering the date .....the date which i enter should be a previous date and should not be a present or future date..if i enter present or future date it should throw error..please help me with the code...It is a mobile web application.. and i am not using date and time picker instead i am using text box

推荐答案

比较日期到今天,如果以后再拒绝它.确实是简单的算法,代码可能需要使用 DateTime结构 [ ^ ]及其方法.
Compare the date to today and reject it if it is later. Simple algorithm really, and the code will probably need to use the DateTime structure[^] and its methods.


希望txtDate.text为dd/MM/yyyy格式
在提交按钮上单击
如果txtDate.text> = Format(Date.UtcNow(),"dd/MM/yyyy")然后
txtDate.text ="
MsgBox(请输入过去的日期")
EndIf
ExitSub

您可以在提交"按钮中编写此代码.单击...,如果条件失败,则按照上层代码退出sub ..
hoping txtDate.text is in dd/MM/yyyy format
on submit button click
if txtDate.text>= Format(Date.UtcNow(),"dd/MM/yyyy") Then
txtDate.text=""
MsgBox("Please Write Past Date")
EndIf
ExitSub

This code You can write in Submit button Click... if condition fails it will exitsub as per Upper code..


这篇关于仅显示前一个日期,而不显示当前和将来的日期.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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