有关编纂的帮助 [英] Help regarding codition

查看:91
本文介绍了有关编纂的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生/女士,




$ b $从表中获取时间为



ds.tables(che)。rows(0).item(time)



我得到的价值



01/01/1900 06:00:00



先生我想在一个区间内检查这个值是多少



06:00:00至08:00:00

我该怎么办,

help ,我关于这个

dear sir/ma''am,


i fetch time from table as

ds.tables("che").rows(0).item("time")

value i got as

01/01/1900 06:00:00

sir i want to check this value lie with in an interval

06:00:00 to 08:00:00
how can i do it,
help ,me regarding this

推荐答案

这样简单的事情怎么样:



How about something simple like this:

if ((ds.tables("che").rows(0).item("time") >= "01/01/1900 06:00") and (ds.tables("che").rows(0).item("time") <= "01/01/1900 08:00")) then


using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime dt_table = DateTime.Now;

            Console.WriteLine(dt_table);

            DateTime dt_compare_1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 12, 0, 0);
            DateTime dt_compare_2 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 1, 0, 0);

            if (dt_table > dt_compare_1 && dt_table < dt_compare_2)
                Console.WriteLine("Time is between 11 and 12 o''clock");
            else
                Console.WriteLine("Time is not between 11 and 12 o''clock");

            Console.ReadKey();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime dt_table = DateTime.Now;

            Console.WriteLine(dt_table);

            DateTime dt_compare_1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 12, 0, 0);
            DateTime dt_compare_2 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 1, 0, 0);

            if (dt_table > dt_compare_1 && dt_table < dt_compare_2)
                Console.WriteLine("Time is between 11 and 12 o'clock");
            else
                Console.WriteLine("Time is not between 11 and 12 o'clock");

            Console.ReadKey();
        }
    }
}


这篇关于有关编纂的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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