如何将时间与日期分开 [英] How to Separate Time from Date

查看:215
本文介绍了如何将时间与日期分开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨:


我是这个论坛的新手。如果我没有通过我的解释,请告诉我。


我需要帮助才能弄清楚如何才能完成以下任务。


我使用VB.net作为前端应用程序,并将其连接到Access数据库


在VB表单中我有一个数据网格。我试图从访问表填充数据网格的数据源。


我有一个访问表(名称:Scheduleitem)。它有6个cols。其中有两个日期/时间列。


日期/时间col#1被命名为开始时间。

日期/时间Col#2被命名为结束时间


开始时间中的条目上校是

9:00 AM

12:00 PM

12:30 PM

1:00 PM

下午5:30。


在数据网格中我希望时间显示。我不想将它转换为字符串,因为排序搞砸了。如果您知道任何其他方法来防止排序搞砸了,请告诉我。


此时我正在使用以下代码。

Hi:

I am new to this forum. If I am not through in my explanation then please let me know.

I need help in figuring out how I can accomplish the following.

I am using VB.net for the front end application, and connecting it to the Access database

In the VB form I have a data grid. I am trying to fill the datasource of the data grid from the access table.

I have an access table (Name: Scheduleitem). It has 6 cols. Out of which there are two Date/Time cols.

Date/Time col #1 is named "Start Time"
Date/Time Col #2 is named "end time"

Entries in "Start time" Col are
9:00 AM
12:00 PM
12:30 PM
1:00 PM
5:30 PM.

In the datagrid I want Time to be displayed. I do not want to convert it to a string because the sorting gets messed up. If you know any other way to prevent the sorting from getting messed up then please let me know.

I am using the following code at this point of time.

展开 | 选择 | 换行 | 行号

推荐答案

试试这个...

Try this ...

展开 | 选择 | Wrap | 行号


Mary :


感谢您的帮助。我非常感谢。


您说:
Mary:

Thanks for the help. I highly appreciate it.

You said:

>>试试这个...
>>Try this ...
展开 | 选择 | Wrap | 行号


单引号将解决该问题。尝试这个,虽然它可能只是把日期放回去。

Single quotes will solve that problem. Try this although it may just put the date back in.

展开 | 选择 | Wrap | 行号


这篇关于如何将时间与日期分开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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