在asp文本框的keypress事件中转换为日期时间格式 [英] convert to date time format in keypress event of asp textbox

查看:68
本文介绍了在asp文本框的keypress事件中转换为日期时间格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

问候



i有问题请帮帮我..



i希望通过javascript在按键文本框中以任意格式转换用户给出的日期时间。

是否可能。?



给出我想要使用的代码..如果有任何问题请纠正..



hello
greetings

i have a problem please help me..

i want to convert date-time given by user in any format in asp text box with key-press event through javascript.
is it possible.?

giving codes that i want to use..if any thing wrong please rectify..

DateTime result;
        if (DateTime.TryParseExact(txtApplicantDate.Text, new string[] { "d-M-yy", "d/M/yy", "d.M.yy", "d-M-yyyy", "d.M.yyyy" }, CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal, out result))
        {
            txtApplicantDate.Text = result.ToShortDateString();
        }





现在我想在java脚本中使用上面的代码,需要用keypress事件调用该函数。

如果可能的话请帮助我。

如果没有那么请给我另一种方法。



问候。



now i want to use the above code in java script and need to call that function with keypress event.
if it possible then help me.
if not then please give me another way to do so.

Regards.

推荐答案

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>

    <script src="../ClientSideScripts/jquery-1.10.0.min.js" type="text/javascript"></script>

    <script type="text/javascript">


document )。ready( function (){
if
(document).ready(function() { if (


#btnOk)。length> 0 ){
("#btnOk").length > 0) {


这篇关于在asp文本框的keypress事件中转换为日期时间格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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