检查是否在特定时间或同一天之后

时间:2019-03-05 17:31:29

标签: asp.net vb.net datetime timespan

我们的VB .Net代码当前会进行检查,以确定是否在同一天提交了请求(例如,我今天今天今天提交请求)。它通过查看与请求的邮政编码相关的时区来实现。

这很好用,但是我想修改逻辑,以便检查在前一天晚上10点开始/触发。当前代码只会在同一天的午夜开始触发。换句话说,不仅是在同一天,而且在提交请求的时间是前一天的晚上10点或更晚时,也会触发该过程。

    ...
    ## Find catkin macros and libraries
    ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
    ## is used, also find other catkin packages
    find_package(catkin REQUIRED COMPONENTS
      roscpp
      std_msgs
      rl_common
      rl_env
      rl_agent
    )

    ## System dependencies are found with CMake's conventions
    # find_package(Boost REQUIRED COMPONENTS system)
    ...
    ## Declare a cpp executable
    # add_executable(rgbd_tools_node src/rgbd_tools_node.cpp)

    add_executable(experiment src/rl.cc)
    # target_link_libraries(experiment agentlib envlib ${catkin_LIBRARIES})
    target_link_libraries(experiment ${catkin_LIBRARIES})

    #add_executable(image_converter src/image_converter.cpp)
    ...

1 个答案:

答案 0 :(得分:0)

取决于您需要如何处理DLS。对于这种类型的逻辑,我有时会在要检查的日期之前减去或增加2小时。

如果没有,则需要获取日期范围。像这样:

Dim curDate = Provider.GetLocalTimeByZipCode(oSearch.ZipCode, 
Now).Date
Dim startDate = curDate.Day.AddHours(-2)
Dim endDate = curDate.Day.AddHours(10)

If oSearch.RequestDate.Date >= startDate AndAlso oSearch.RequestDate.Date <= endDate Then