本文介绍了我如何仅从日期时间获得军事时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何获得军事时间而不是约会日期。目前退货。
11/25/2016 1:30:00 AM
我想要看看
13:30
How do i get military time and not the date. currently it returns this.
11/25/2016 1:30:00 AM
I want to see
13:30
var start_time = dateTimePicker1.Text;
var start_time_array = start_time.Split(':');
var today = DateTime.Now;
var trailer_count = Convert.ToInt32(tbTrailer_Needed.Text);
var minutes_apart = Convert.ToDouble(tbTime_Between.Text);
var calculated_start_time = new DateTime(today.Year, today.Month, today.Day, Convert.ToInt16(start_time_array[0]), Convert.ToInt16(start_time_array[1]), 00);
我的尝试:
这些都不起作用
我尝试过Mask并调整属性。
var time = value.TimeOfDay;
What I have tried:
None of these worked
I have tried Mask and adjusting property.
var time = value.TimeOfDay;
DateTime.Now.ToString("hh:mm:ss")
推荐答案
int time24 = mtTime.Hour * 100 + myTime.Minute;
这篇关于我如何仅从日期时间获得军事时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!