Timespan令人困惑,请帮助大脑冻结。 [英] Timespan perplexing, please help with brain freeze.

查看:61
本文介绍了Timespan令人困惑,请帮助大脑冻结。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,有人可以给我一些编码帮助吗?

*应该*真的很简单,但我很难挣扎。


我需要两次之间的差异(目标/实际)

然而,这些时间将介于开始和开始之间。结束时间

此外,还有Break&开始和开始之间的午餐时间结束。


示例...

开始08:00

休息开始10:30

休息结束10:40

午餐开始12:00

午餐结束12:30

休息开始14:30

休息结束14:40

结束16:00


目标10:12

实际10:36


目标与实际(结果)....

实时 - 24分钟
制作时间 - 18分钟
注意:

该解决方案将满足任何延迟时间,例如

目标1-Feb-06 14:23,实际2 -Feb-06 11:52


我怎么想我会这样做...


Dim ts as TimeSpanEx

ts.AddStart" 1-Feb-06 08:00"

ts.AddStop" 1-Feb-06 10:30"

ts.AddStart" 1-Feb-06 10:40"

ts.AddStop" 1-Feb-06 12:00"

ts.AddStart" 1-Feb-06 12:30"

ts.AddStop" 1-Feb-06 14:30"

ts.AddStart&quo t; 1-Feb-06 14:40"

ts.AddStop" 1-Feb-06 16:00"


ts.AddStart" 2-Feb-06 08:00"

ts.AddStop" 2-Feb-06 10:30"

ts.AddStart" 2-Feb-06 10 :40"

ts.AddStop" 2-Feb-06 12:00"

ts.AddStart" 2-Feb-06 12:30"

ts.AddStop" 2-Feb-06 14:30"

ts.AddStart" 2-Feb-06 14:40"

ts .AddStop" 2-Feb-06 16:00"


Dim tsResult as TimeSpan

tsResult = ts.CalculateDuration(" 1-Feb-06 14:23,2-Feb-06 11:52 )


....只需弄清楚TimeSpanEx类的内容!


我可以创建AddStart& AddStop函数(在数组或列表中存储时间)但是我不能在我的生活中得到一个有效的CalculateDuration(Target,Actual)函数。

我希望答案是如此明显和很简单,我踢了好几天了!


谢谢,史蒂夫。

Hi all, can someone give me some coding help with a problem that
*should* be really simple, yet I''m struggling with.

I need the difference between 2 times (Target / Actual)
However, these times will fall somewhere between a Start & End time
Further more, there will be Break & Lunch times between Start & End.

Example...
Start 08:00
Break start 10:30
Break end 10:40
Lunch start 12:00
Lunch end 12:30
Break start 14:30
Break end 14:40
End 16:00

Target 10:12
Actual 10:36

Target vs. Actual (results)....
Real Time - 24 min
Production Time - 18 min
NOTES:
The solution will cater for any amount of delay e.g.
Target "1-Feb-06 14:23", Actual "2-Feb-06 11:52")

How I imagined I''d do this...

Dim ts as TimeSpanEx
ts.AddStart "1-Feb-06 08:00"
ts.AddStop "1-Feb-06 10:30"
ts.AddStart "1-Feb-06 10:40"
ts.AddStop "1-Feb-06 12:00"
ts.AddStart "1-Feb-06 12:30"
ts.AddStop "1-Feb-06 14:30"
ts.AddStart "1-Feb-06 14:40"
ts.AddStop "1-Feb-06 16:00"

ts.AddStart "2-Feb-06 08:00"
ts.AddStop "2-Feb-06 10:30"
ts.AddStart "2-Feb-06 10:40"
ts.AddStop "2-Feb-06 12:00"
ts.AddStart "2-Feb-06 12:30"
ts.AddStop "2-Feb-06 14:30"
ts.AddStart "2-Feb-06 14:40"
ts.AddStop "2-Feb-06 16:00"

Dim tsResult as TimeSpan
tsResult = ts.CalculateDuration("1-Feb-06 14:23", "2-Feb-06 11:52" )

....Just gotta figure out the contents of TimeSpanEx class!

I can create the AddStart & AddStop functions (store times in an array or list) but I
cannot for the life of me get a working CalculateDuration(Target, Actual) function going.
I hope the answer is so obvious & simple that I kick myself for days!

Thanks, Steve.

推荐答案

史蒂夫,


我相信有人可以帮你这个...但是没有b $ b抵抗说:

//

开始08:00

休息开始10:30

休息结束10:40

午餐开始12:00

午餐结束12:30

休息开始14:30

休息结束14:40

结束16:00

\\


男!希望我有那种休息! ;-))

问候,


Cerebrus。

Hi Steve,

I''m sure someone will be able to help you with this... but couldn''t
resist saying this :
//
Start 08:00
Break start 10:30
Break end 10:40
Lunch start 12:00
Lunch end 12:30
Break start 14:30
Break end 14:40
End 16:00
\\

Man ! Wish I had those kind of breaks ! ;-))

Regards,

Cerebrus.


嗨SD00,


我不知道这是不是学生的问题。它看起来就像那样。


我们尽量不帮助那些。


它看起来像是因为我看不到任何消除。


你的问题是什么影响你的计算,这只是开始的时间

休息时间从10:30开始,而结束时间晚于结束时

实际。所以开始的时间取代了你要计算的时间的结束时间

。事实就是这一切。


我希望这会有所帮助,


Cor

" sd00" <无****** @ please.com> schreef在bericht

新闻:eu ************** @ TK2MSFTNGP05.phx.gbl ...
Hi SD00,

I don''t know if this is a student question. It looks like that.

We try not to help with those.

It looks like that because I see no eliminiations.

Your problem is what affects your caculation and that is only the start of
the break starts at 10:30 while the end of that is later than the end of the
Actual. So the begin time of that replaces the end time of the time you have
to calculate. In fact is that all.

I hope this helps,

Cor
"sd00" <no******@please.com> schreef in bericht
news:eu**************@TK2MSFTNGP05.phx.gbl...
大家好,有人可以给我一些编码帮助以解决一个问题,即*应该*非常简单,但我正在努力。

我需要2次之间的差异(目标/实际)此外,还有Break&开始和开始之间的午餐时间结束。

示例......
开始08:00
休息开始10:30
休息结束10:40
午餐开始12:00
午餐结束12:30
休息开始14:30
休息结束14:40
结束16:00

目标10:12
实际10:36

目标与实际(结果)....
实时 - 24分钟
制作时间 - 18分钟

注意:
解决方案将迎合任何延迟,例如,目标1月2日14:23,实际2月2日11:52)
<我多么想象我会这样做......

Dim ts as TimeSpanEx
ts.AddStart" 1-Feb-06 08:00"
ts .AddStop" 1-Feb-06 10:30>
ts.AddStart" 1-Feb-06 10:40"
ts.AddStop" 1-Feb-06 12:00"
ts.AddStart" 1-Feb-06 12:30"
ts.AddStop" 1-Feb-06 14:30"
ts.AddStart" 1-Feb-06 14 :40"
ts.AddStop" 1-Feb-06 16:00"

ts.AddStart" 2-Feb-06 08:00"
ts.A ddStop2-Feb-06 10:30
ts.AddStart" 2-Feb-06 10:40"
ts.AddStop" 2-Feb-06 12:00< br /> ts.AddStart" 2-Feb-06 12:30"
ts.AddStop" 2-Feb-06 14:30"
ts.AddStart" 2-Feb-06 14: 40"
ts.AddStop" 2-Feb-06 16:00"

Dim tsResult as TimeSpan
tsResult = ts.CalculateDuration(" 1-Feb-06 14 :23"," 2-Feb-06 11:52" )

...只需弄清楚TimeSpanEx类的内容!

我可以创建AddStart& AddStop函数(在数组或
列表中存储时间)但是我不能在我的生活中得到一个有效的CalculateDuration(Target,Actual)
函数。

我希望答案是如此明显而且很简单,我踢了好几天了!

谢谢,史蒂夫。
Hi all, can someone give me some coding help with a problem that
*should* be really simple, yet I''m struggling with.

I need the difference between 2 times (Target / Actual)
However, these times will fall somewhere between a Start & End time
Further more, there will be Break & Lunch times between Start & End.

Example...
Start 08:00
Break start 10:30
Break end 10:40
Lunch start 12:00
Lunch end 12:30
Break start 14:30
Break end 14:40
End 16:00

Target 10:12
Actual 10:36

Target vs. Actual (results)....
Real Time - 24 min
Production Time - 18 min
NOTES:
The solution will cater for any amount of delay e.g.
Target "1-Feb-06 14:23", Actual "2-Feb-06 11:52")

How I imagined I''d do this...

Dim ts as TimeSpanEx
ts.AddStart "1-Feb-06 08:00"
ts.AddStop "1-Feb-06 10:30"
ts.AddStart "1-Feb-06 10:40"
ts.AddStop "1-Feb-06 12:00"
ts.AddStart "1-Feb-06 12:30"
ts.AddStop "1-Feb-06 14:30"
ts.AddStart "1-Feb-06 14:40"
ts.AddStop "1-Feb-06 16:00"

ts.AddStart "2-Feb-06 08:00"
ts.AddStop "2-Feb-06 10:30"
ts.AddStart "2-Feb-06 10:40"
ts.AddStop "2-Feb-06 12:00"
ts.AddStart "2-Feb-06 12:30"
ts.AddStop "2-Feb-06 14:30"
ts.AddStart "2-Feb-06 14:40"
ts.AddStop "2-Feb-06 16:00"

Dim tsResult as TimeSpan
tsResult = ts.CalculateDuration("1-Feb-06 14:23", "2-Feb-06 11:52" )

...Just gotta figure out the contents of TimeSpanEx class!

I can create the AddStart & AddStop functions (store times in an array or
list) but I
cannot for the life of me get a working CalculateDuration(Target, Actual)
function going.
I hope the answer is so obvious & simple that I kick myself for days!

Thanks, Steve.



你显然有一堂课(TimeSpanEx) )实现这个

CalculateDuration方法。


因为我们无法知道这个课程究竟发生了什么,所以它是
$ b $我们很难告诉你如何让它正常工作。


那就是说,如果我试图实现类似的功能

然后这就是我接近它的方式。


- 将每个''工作期'视为一个具有

StartTime和一个的TimeCard对象EndTime属性(DateTime)


- 如果两者都被认为是完整的TimeCard对象

StartTime和EndTime属性具有有效值。


- TimeCard对象可能有一个只读的持续时间

属性(TimeSpan),它返回

之间的差异开始如果TimeCard

对象不完整,则Time和EndTime属性或Nothing。


- TimeCards对象将实现为
$ b的集合$ b具有持续时间方法的TimeCard对象(TimeSpan)

将返回个人的总时间间隔完成的
TimeCard对象。可能会实施持续时间

方法的超载,以便结果可以按日期时间范围和其他标准进行过滤。


- 只要开始和结束时间按顺序记录,那么

就没有问题将结束时间分配给

相关的不完整对象。 />
" sd00" <无****** @ please.com>在留言中写道

新闻:eu ************** @ TK2MSFTNGP05.phx.gbl ...
You obviously have a class (TimeSpanEx) that implements this
CalculateDuration method.

Because we have no way of knowing what actually happens in this class, it is
difficult for us to advise you on how to make it work correctly.

That said, if I were to attempt to implement a similar type of functionality
then this is the way I would approach it.

- Treat each ''work period'' as a TimeCard object that has both a
StartTime and an EndTime property (DateTime)

- The TimeCard object would be considered to be complete if both
The StartTime and EndTime properties have a valid value.

- The TimeCard object would possibly have a readonly Duration
property (TimeSpan) that returns the difference between the
StartTime and EndTime properties or Nothing if the TimeCard
object is incomplete.

- A TimeCards object would be implemented as a collection of
TimeCard objects with a Duration method (TimeSpan)
that would return the total of the timespans of the individual
TimeCard objects that are complete. Overloads of the Duration
methods would possibly be implemented so that the result can
be filtered by datetime range(s) and other criteria.

- As long as start and end times are recorded in sequence then
there would be no problem assigning an end time to the
pertinent incomplete object.
"sd00" <no******@please.com> wrote in message
news:eu**************@TK2MSFTNGP05.phx.gbl...
大家好,有人可以给我一些编码帮助以解决一个问题,即*应该*非常简单,但我正在努力。

我需要2次之间的差异(目标/实际)此外,还有Break&开始和开始之间的午餐时间结束。

示例......
开始08:00
休息开始10:30
休息结束10:40
午餐开始12:00
午餐结束12:30
休息开始14:30
休息结束14:40
结束16:00

目标10:12
实际10:36

目标与实际(结果)....
实时 - 24分钟
制作时间 - 18分钟

注意:
解决方案将迎合任何延迟,例如,目标1月2日14:23,实际2月2日11:52)
<我多么想象我会这样做......

Dim ts as TimeSpanEx
ts.AddStart" 1-Feb-06 08:00"
ts .AddStop" 1-Feb-06 10:30>
ts.AddStart" 1-Feb-06 10:40"
ts.AddStop" 1-Feb-06 12:00"
ts.AddStart" 1-Feb-06 12:30"
ts.AddStop" 1-Feb-06 14:30"
ts.AddStart" 1-Feb-06 14 :40"
ts.AddStop" 1-Feb-06 16:00"

ts.AddStart" 2-Feb-06 08:00"
ts.A ddStop2-Feb-06 10:30
ts.AddStart" 2-Feb-06 10:40"
ts.AddStop" 2-Feb-06 12:00< br /> ts.AddStart" 2-Feb-06 12:30"
ts.AddStop" 2-Feb-06 14:30"
ts.AddStart" 2-Feb-06 14: 40"
ts.AddStop" 2-Feb-06 16:00"

Dim tsResult as TimeSpan
tsResult = ts.CalculateDuration(" 1-Feb-06 14 :23"," 2-Feb-06 11:52" )

...只需弄清楚TimeSpanEx类的内容!

我可以创建AddStart& AddStop函数(在数组或
列表中存储时间)但是我不能在我的生活中得到一个有效的CalculateDuration(Target,Actual)
函数。

我希望答案是如此明显而且很简单,我踢了好几天!

谢谢,史蒂夫。
Hi all, can someone give me some coding help with a problem that
*should* be really simple, yet I''m struggling with.

I need the difference between 2 times (Target / Actual)
However, these times will fall somewhere between a Start & End time
Further more, there will be Break & Lunch times between Start & End.

Example...
Start 08:00
Break start 10:30
Break end 10:40
Lunch start 12:00
Lunch end 12:30
Break start 14:30
Break end 14:40
End 16:00

Target 10:12
Actual 10:36

Target vs. Actual (results)....
Real Time - 24 min
Production Time - 18 min
NOTES:
The solution will cater for any amount of delay e.g.
Target "1-Feb-06 14:23", Actual "2-Feb-06 11:52")

How I imagined I''d do this...

Dim ts as TimeSpanEx
ts.AddStart "1-Feb-06 08:00"
ts.AddStop "1-Feb-06 10:30"
ts.AddStart "1-Feb-06 10:40"
ts.AddStop "1-Feb-06 12:00"
ts.AddStart "1-Feb-06 12:30"
ts.AddStop "1-Feb-06 14:30"
ts.AddStart "1-Feb-06 14:40"
ts.AddStop "1-Feb-06 16:00"

ts.AddStart "2-Feb-06 08:00"
ts.AddStop "2-Feb-06 10:30"
ts.AddStart "2-Feb-06 10:40"
ts.AddStop "2-Feb-06 12:00"
ts.AddStart "2-Feb-06 12:30"
ts.AddStop "2-Feb-06 14:30"
ts.AddStart "2-Feb-06 14:40"
ts.AddStop "2-Feb-06 16:00"

Dim tsResult as TimeSpan
tsResult = ts.CalculateDuration("1-Feb-06 14:23", "2-Feb-06 11:52" )

...Just gotta figure out the contents of TimeSpanEx class!

I can create the AddStart & AddStop functions (store times in an array or
list) but I
cannot for the life of me get a working CalculateDuration(Target, Actual)
function going.
I hope the answer is so obvious & simple that I kick myself for days!

Thanks, Steve.



这篇关于Timespan令人困惑,请帮助大脑冻结。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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