两个日期之间的日期代码 [英] code for date between two dates

查看:82
本文介绍了两个日期之间的日期代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我需要一些帮助才能使我的代码正常工作。我需要vba在两个周期之间自动计算:

- 6月1日和1月nov

- 1月11日和6月1日

提前致谢对于你的建议。



De代码如下:

Hello here,
I need some help to make my code work. I need vba to make automatically calculations bettween two periodes:
- 1st june and 1st nov
- 1st nov and 1st june
Thanks in advance for your advises.


De code looks like this:

展开 | 选择 | 换行 | 行号

推荐答案

bambin,

欢迎来到Bytes.com。你会在这里找到很多帮助,但我们确实要求你在发布时遵循一些简单的规则。


请务必使用您发布的任何编程代码周围的标签。您可以通过单击[CODE /]按钮并在标签之间键入或粘贴代码来实现。


要回答您的问题,请查看datediff函数。它为您提供了一种计算日期之间天数的简单方法。它可以计算小时,月,年等的差异。


你会使用像
bambin,
Welcome to Bytes.com. You''ll find plenty of help here but we do ask that you follow a few simple rules when posting.

Please be sure to use tags around any programming code you post. You can do that by clicking the [CODE/] button and the typing or pasting your code between the tags.

To answer your question, look at the datediff function. It gives you a simple way to calculate days between dates. It can calculate differences in hours, months, years and so on.

You''ll use something like
这样的东西
展开 | 选择 | Wrap | 行号


Hello Jim,

感谢您的回复。 Wat我需要的是根据一年中的时段使vba返回正确的信息(计算)。使用datediff函数我只能计算yaers中的差异,月...

我使用代码
Hello Jim,
Thanks for replying. Wat I need is to make vba returning de correct informations(calculations) depending on the period of the year. With the datediff function I can only calculat the diffference in yaers,month...
I use the code
展开 | 选择 | 换行 | 行号


听起来你需要Between()函数。
It sounds like you need the Between() Function.
展开 | 选择 | Wrap | 行号


这篇关于两个日期之间的日期代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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