如何获得每小时的金额. [英] how to get the amount in per hour.

查看:91
本文介绍了如何获得每小时的金额.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网吧,所以我想为商店创建一个计时器.

这是我的代码,请您能帮助我如何获得每小时的金额或进行计算.您能帮我找到一种更好的方法来计算每3分钟的金额吗?

谢谢您的帮助...

i have an internet cafe so i want to create a timer for the shop.

this is my code and please can you help me on how to get the amount per hour or to compute for it. can you help me to have a better way on how to compute the amount in every 3minutes

thank you for the help...

private void timer_pc2_Tick(object sender, EventArgs e)
      {//to get the amount in every 3 minutes
          count_pc2 += 1;
          if (count_pc2 == 1800)
          {
              amount_pc2 += 1;
              lblamount_pc2.Text = "P" + " " + (amount_pc2.ToString()) + ".00";
              count_pc2 = 1640;
          }
          //count time
          diffA[2] = DateTime.Now - startTime[2];
          diffB[2] = new TimeSpan(diffA[2].Hours, diffA[2].Minutes, diffA[2].Seconds);
          this.lbltime_pc2.Text = (diffB[2].ToString());
          if (this.lbltime_pc2.Text == diff[2].ToString())
          {
              this.timer_pc2.Enabled = false;
              endTime[2] = DateTime.Now.AddMinutes(0);
          }
      }

推荐答案

int minutesPerHour = 60;
int secondsPerMinute = 60;
TicksPerHour = minutesPerHour * secondsPerMinute * yourTimer.Interval/1000;
int minutesPerHour = 60;
int secondsPerMinute = 60;
TicksPerHour = minutesPerHour * secondsPerMinute * yourTimer.Interval / 1000;


这篇关于如何获得每小时的金额.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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