1.VB6中想用GetTickCount函数调出系统开机到现在所用的时间具体该怎么做啊?在线等~~

2.VB显示当前时间的程序

3.vb读取本地时间

4.vb或者C或C++中 有没有什么代码可以获得当前系统启动时间

5.用VBA获取指定计算机上的系统时间

6.用VB怎么获取系统时间?

vb中时间日期获取时分,vb获取电脑系统时间

日期:DateTime.Now.ToShortDateString

时间:DateTime.Now.ToFileTime

可以这样用:

Response.Write(DateTime.Now.ToShortDateString() + "<br/>");

Response.Write(DateTime.Now.ToShortTimeString() + "<br/>");

输出:

2007-1-29

8:49

Response.Write(DateTime.Now.ToLongDateString() + "<br/>");

Response.Write(DateTime.Now.ToLongTimeString() + "<br/>");

输出:

2007年1月29日

8:49:15

不知合不合你要求

我是要VS2005下使用,很好用。可查看MSDN以下简单例出:

.NET Framework 类库

DateTime 成员

请参见 构造函数 字段 方法 属性 显式接口实现

全部折叠 全部展开 成员选项:全部显示 成员选项:已筛选

包括继承的成员

包括受保护的成员

仅 .NET Compact Framework 成员

表示时间上的一刻,通常以日期和当天的时间表示。

下表列出了由 DateTime 类型公开的成员。

公共构造函数

名称 说明

DateTime 已重载。初始化 DateTime 结构的新实例。

页首

公共字段

名称 说明

MaxValue 表示 DateTime 的最大可能值。此字段为只读。

MinValue 表示 DateTime 的最小可能值。此字段为只读。

页首

公共属性

名称 说明

Date 获取此实例的日期部分。

Day 获取此实例所表示的日期为该月中的第几天。

DayOfWeek 获取此实例所表示的日期是星期几。

DayOfYear 获取此实例所表示的日期是该年中的第几天。

Hour 获取此实例所表示日期的小时部分。

Kind 获取一个值,该值指示由此实例表示的时间是基于本地时间、协调通用时间 (UTC),还是两者皆否。

Millisecond 获取此实例所表示日期的毫秒部分。

Minute 获取此实例所表示日期的分钟部分。

Month 获取此实例所表示日期的月份部分。

Now 获取一个 DateTime 对象,该对象设置为此计算机上的当前日期和时间,表示为本地时间。

Second 获取此实例所表示日期的秒部分。

Ticks 获取表示此实例的日期和时间的刻度数。

TimeOfDay 获取此实例的当天的时间。

Today 获取当前日期。

UtcNow 获取一个 DateTime 对象,该对象设置为此计算机上的当前日期和时间,表示为协调通用时间 (UTC)。

Year 获取此实例所表示日期的年份部分。

页首

公共方法

名称 说明

Add 将指定的 TimeSpan 的值加到此实例的值上。

AddDays 将指定的天数加到此实例的值上。

AddHours 将指定的小时数加到此实例的值上。

AddMilliseconds 将指定的毫秒数加到此实例的值上。

AddMinutes 将指定的分钟数加到此实例的值上。

AddMonths 将指定的月份数加到此实例的值上。

AddSeconds 将指定的秒数加到此实例的值上。

AddTicks 将指定的刻度数加到此实例的值上。

AddYears 将指定的年份数加到此实例的值上。

Compare 比较 DateTime 的两个实例,并返回它们相对值的指示。

CompareTo 已重载。 将此实例与指定的对象或值类型进行比较,并返回二者相对值的指示。

DaysInMonth 返回指定年和月中的天数。

Equals 已重载。 返回一个值,该值指示两个 DateTime 对象,或者一个 DateTime 实例和另一个对象或 DateTime 是否相等。

FromBinary 反序列化一个 64 位二进制值,并重新创建序列化的 DateTime 初始对象。

FromFileTime 将指定的 Windows 文件时间转换为等效的本地时间。

FromFileTimeUtc 将指定的 Windows 文件时间转换为等效的 UTC 时间。

FromOADate 返回与指定的 OLE 自动化日期等效的 DateTime。

GetDateTimeFormats 已重载。 将此实例的值转换为标准 DateTime 格式说明符支持的所有字符串表示形式。

GetHashCode 已重写。 返回此实例的哈希代码。

GetType 获取当前实例的 Type。 (从 Object 继承。)

GetTypeCode 返回值类型 DateTime 的 TypeCode。

IsDaylightSavingTime 指示此 DateTime 实例是否在当前时区的夏时制范围内。

IsLeapYear 返回指定的年份是否为闰年的指示。

op_Addition 将指定的时间间隔加到指定的日期和时间以生成新的日期和时间。

op_Equality 确定 DateTime 的两个指定的实例是否相等。

op_GreaterThan 确定指定的 DateTime 是否大于另一个指定的 DateTime。

op_GreaterThanOrEqual 确定指定的 DateTime 是否大于或等于另一个指定的 DateTime。

op_Inequality 确定 DateTime 的两个指定的实例是否不等。

op_LessThan 确定指定的 DateTime 是否小于另一个指定的 DateTime。

op_LessThanOrEqual 确定指定的 DateTime 是否小于或等于另一个指定的 DateTime。

op_Subtraction 已重载。 从指定的 DateTime 减去指定的 DateTime 或 TimeSpan。

Parse 已重载。 将日期和时间的指定字符串表示转换成其等效的 DateTime。

ParseExact 已重载。 将日期和时间的指定字符串表示转换成其等效的 DateTime。该字符串表示形式的格式必须与指定的格式完全匹配。

ReferenceEquals 确定指定的 Object 实例是否是相同的实例。 (从 Object 继承。)

SpecifyKind 创建新的 DateTime 对象,该对象表示与指定的 DateTime 相同的时间,但是根据指定的 DateTimeKind 值的指示,指定为本地时间或协调通用时间 (UTC),或者两者皆否。

Subtract 已重载。 从此实例中减去指定的时间或持续时间。

ToBinary 将当前 DateTime 对象序列化为一个 64 位二进制值,该值随后可用于重新创建 DateTime 对象。

ToFileTime 将当前 DateTime 对象的值转换为 Windows 文件时间。

ToFileTimeUtc 将当前 DateTime 对象的值转换为 Windows 文件时间。

ToLocalTime 将当前 DateTime 对象的值转换为本地时间。

ToLongDateString 将此实例的值转换为其等效的长日期字符串表示形式。

ToLongTimeString 将此实例的值转换为其等效的长时间字符串表示形式。

ToOADate 将此实例的值转换为等效的 OLE 自动化日期。

ToShortDateString 将此实例的值转换为其等效的短日期字符串表示形式。

ToShortTimeString 将此实例的值转换为其等效的短时间字符串表示形式。

ToString 已重载。 已重写。 将此实例的值转换为其等效的字符串表示。

ToUniversalTime 将当前 DateTime 对象的值转换为协调通用时间 (UTC)。

TryParse 已重载。 将日期和时间的指定字符串表示转换成其等效的 DateTime。

TryParseExact 已重载。 将日期和时间的指定字符串表示转换成其等效的 DateTime。该字符串表示形式的格式必须与指定的格式完全匹配。

页首

显式接口实现

名称 说明

System.IConvertible.ToBoolean 不支持此转换。尝试这样做会引发 InvalidCastException。

System.IConvertible.ToByte 不支持此转换。尝试这样做会引发 InvalidCastException。

System.IConvertible.ToChar 不支持此转换。尝试这样做会引发 InvalidCastException。

System.IConvertible.ToDateTime 返回当前 DateTime 对象。

System.IConvertible.ToDecimal 不支持此转换。尝试这样做会引发 InvalidCastException。

System.IConvertible.ToDouble 不支持此转换。尝试这样做会引发 InvalidCastException。

System.IConvertible.ToInt16 不支持此转换。尝试这样做会引发 InvalidCastException。

System.IConvertible.ToInt32 不支持此转换。尝试这样做会引发 InvalidCastException。

System.IConvertible.ToInt64 不支持此转换。尝试这样做会引发 InvalidCastException。

System.IConvertible.ToSByte 不支持此转换。尝试这样做会引发 InvalidCastException。

System.IConvertible.ToSingle 不支持此转换。尝试这样做会引发 InvalidCastException。

System.IConvertible.ToType 将当前的 DateTime 对象转换为指定类型的对象。

System.IConvertible.ToUInt16 不支持此转换。尝试这样做会引发 InvalidCastException。

System.IConvertible.ToUInt32 不支持此转换。尝试这样做会引发 InvalidCastException。

System.IConvertible.ToUInt64 不支持此转换。尝试这样做会引发 InvalidCastException。

System.Runtime.Serialization.ISerializable.GetObjectData 使用序列化当前 DateTime 对象所需要的数据来填充 SerializationInfo 对象。

页首

请参见

参考

DateTime 结构

VB6中想用GetTickCount函数调出系统开机到现在所用的时间具体该怎么做啊?在线等~~

不用vb 直接打开命令提示符 输入 net user 用户名

回车

就会显示你是什么时候开机的

@echo off&color 0c&mode concols=45lines=15&set/p a=请输入用户名:

:: 如果不知道用户名就输入"%username%"

for /f "delims=" %%a in ('net user %a%^|findstr "上次登录"')do echo %%a

pause

复制上面的代码 保存bat类型文件

如果一定要vb的话

可以直接用最简单的方法

shell "cmd /c net user 用户名>>结果.txt"

open …

text1.text = …

就这样读取

VB显示当前时间的程序

在Module中加入GetTickCount声明

Public?Declare?Function?GetTickCount?Lib?"kernel32"?()?As?Long

然后就可以直接用了

Dim?k,?hm,?mi,?se,?ms?As?Long

k?=?GetTickCount()

hm?=?k?\?3600000

mi?=?(k?-?3600000?*?hm)?\?60000

se?=?(k?-?3600000?*?hm?-?60000?*?mi)?\?1000

ms?=?k?Mod?1000

Label1.Caption?=?hm?&?":"?&?mi?&?":"?&?se?&?"."?&?ms

vb读取本地时间

加入计时器 timer1 ?和一个textbox

窗体里加入以下代码:

Private Sub Form_Load()

Text1.Text = Now

Timer1.Enabled = True

Timer1.Interval = 1000

End Sub

Private Sub Timer1_Timer()

Text1.Text = Now

End Sub

如果你只想显示日期,则把Text1.Text = Now 改为:Text1.Text = date

如果你只想显示时间,则把Text1.Text = Now 改为:

Text1.Text = Hour(Time) & ":" & Minute(Time) & ":" & Second(Time)

扩展资料:

Visual Basic(简称VB)是Microsoft公司开发的一种通用的基于对象的程序设计语言,为结构化的、模块化的、面向对象的、包含协助开发环境的事件驱动为机制的可视化程序设计语言。是一种可用于微软自家产品开发的语言。?

“Visual” 指的是开发图形用户界面 (GUI) 的方法——不需编写大量代码去描述界面元素的外观和位置,而只要把预先建立的对象add到屏幕上的一点即可。 “Basic”指的是 BASIC (Beginners All-Purpose Symbolic Instruction Code) 语言,是一种在计算技术发展历史上应用得最为广泛的语言。

Visual Basic源自于BASIC编程语言。VB拥有图形用户界面(GUI)和快速应用程序开发(RAD)系统,可以轻易的使用DAO、RDO、ADO连接数据库,或者轻松的创建Active?X控件,用于高效生成类型安全和面向对象的应用程序? 。程序员可以轻松的使用VB提供的组件快速建立一个应用程序。

参考资料:

VB--百度百科

vb或者C或C++中 有没有什么代码可以获得当前系统启动时间

使用Date函数即可,例如:text1.text=Date ,text1便可以显示当前日期的。

比较日期时不需要什么函数,可以将时间写成时间字符串格式,然后用大于号小于号便可以对比大小。

比如:

If #2/23/2010# > #4/2/2010# Then

MsgBox "大于"

Else

MsgBox "小于"

End If

若将读取出来的日期和自己设定的日期做对比,如下:

if date() > #2/23/2010# then

....

end if

即可实现。

Datediff函数也可以,只是根据您的要求,不需要使用这个函数。

用VBA获取指定计算机上的系统时间

#include <time.h>

#include <stdio.h>

#include <sys/types.h>

#include <sys/timeb.h>

#include <string.h>

void main()

{

char tmpbuf[128], ampm[] = "AM";

time_t ltime;

struct _timeb tstruct;

struct tm *today, *gmt, xmas = { 0, 0, 12, 25, 11, 93 };

/* Set time zone from TZ environment variable. If TZ is not set,

* the operating system is queried to obtain the default value

* for the variable.

*/

_tzset();

/* Display operating system-style date and time. */

_strtime( tmpbuf );

printf( "OS time:\t\t\t\t%s\n", tmpbuf );

_strdate( tmpbuf );

printf( "OS date:\t\t\t\t%s\n", tmpbuf );

/* Get UNIX-style time and display as number and string. */

time( &ltime );

printf( "Time in seconds since UTC 1/1/70:\t%ld\n", ltime );

printf( "UNIX time and date:\t\t\t%s", ctime( &ltime ) );

/* Display UTC. */

gmt = gmtime( &ltime );

printf( "Coordinated universal time:\t\t%s", asctime( gmt ) );

/* Convert to time structure and adjust for PM if necessary. */

today = localtime( &ltime );

if( today->tm_hour > 12 )

{

strcpy( ampm, "PM" );

today->tm_hour -= 12;

}

if( today->tm_hour == 0 ) /* Adjust if midnight hour. */

today->tm_hour = 12;

/* Note how pointer addition is used to skip the first 11

* characters and printf is used to trim off terminating

* characters.

*/

printf( "12-hour time:\t\t\t\t%.8s %s\n",

asctime( today ) + 11, ampm );

/* Print additional time information. */

_ftime( &tstruct );

printf( "Plus milliseconds:\t\t\t%u\n", tstruct.millitm );

printf( "Zone difference in seconds from UTC:\t%u\n",

tstruct.timezone );

printf( "Time zone name:\t\t\t\t%s\n", _tzname[0] );

printf( "Daylight savings:\t\t\t%s\n",

tstruct.dstflag ? "YES" : "NO" );

/* Make time for noon on Christmas, 1993. */

if( mktime( &xmas ) != (time_t)-1 )

printf( "Christmas\t\t\t\t%s\n", asctime( &xmas ) );

/* Use time structure to build a customized time string. */

today = localtime( &ltime );

/* Use strftime to build a customized time string. */

strftime( tmpbuf, 128,

"Today is %A, day %d of %B in the year %Y.\n", today );

printf( tmpbuf );

}

msdn上的

用VB怎么获取系统时间?

Option?Explicit

Private?Declare?Function?NetRemoteTOD?Lib?"Netapi32.dll"?(?_

tServer?As?Any,?pBuffer?As?Long)?As?Long

Private?Type?SYSTEMTIME

wYearAs?Integer

wMonthAs?Integer

wDayOfWeekAs?Integer

wDayAs?Integer

wHourAs?Integer

wMinuteAs?Integer

wSecondAs?Integer

wMillisecondsAs?Integer

End?Type

Private?Type?TIME_ZONE_INFORMATION

BiasAs?Long

StandardName(32)As?Integer

StandardDateAs?SYSTEMTIME

StandardBiasAs?Long

DaylightName(32)As?Integer

DaylightDateAs?SYSTEMTIME

DaylightBiasAs?Long

End?Type

Private?Declare?Function?GetTimeZoneInformation?Lib?"kernel32"?(lpTimeZoneInformation?As?TIME_ZONE_INFORMATION)?As?Long

Private?Declare?Function?NetApiBufferFree?Lib?"Netapi32.dll"?(ByVal?lpBuffer?As?Long)?As?Long

Private?Type?TIME_OF_DAY_INFO

tod_elapsedtAs?Long

tod_msecsAs?Long

tod_hoursAs?Long

tod_minsAs?Long

tod_secsAs?Long

tod_hundsAs?Long

tod_timezoneAs?Long

tod_tintervalAs?Long

tod_dayAs?Long

tod_monthAs?Long

tod_yearAs?Long

tod_weekdayAs?Long

End?Type

Private?Declare?Sub?CopyMemory?Lib?"kernel32"?Alias?"RtlMoveMemory"?(Destination?As?Any,?Source?As?Any,?ByVal?Length?As?Long)

Public?Function?getRemoteTOD(ByVal?strServer?As?String)?As?Date

Dim?result?As?Date

Dim?lRet?As?Long

Dim?tod?As?TIME_OF_DAY_INFO

Dim?lpbuff?As?Long

Dim?tServer()?As?Byte

tServer?=?strServer?&?vbNullChar

lRet?=?NetRemoteTOD(tServer(0),?lpbuff)

If?lRet?=?0?Then

CopyMemory?tod,?ByVal?lpbuff,?Len(tod)

NetApiBufferFree?lpbuff

result?=?DateSerial(tod.tod_year,?tod.tod_month,?tod.tod_day)?+?_

TimeSerial(tod.tod_hours,?tod.tod_mins?-?tod.tod_timezone,?tod.tod_secs)

getRemoteTOD?=?result

Else

Err.Raise?Number:=vbObjectError?+?1001,?_

Description:="cannotgetremoteTOD"

End?If

End?Function

Private?Sub?Command1_Click()

Dim?d?As?Date

d?=?getRemoteTOD("\\192.168.0.9")

MsgBox?d

End?Sub

日期:DateTime.Now.ToShortDateString

时间:DateTime.Now.ToFileTime

可以这样用:

Response.Write(DateTime.Now.ToShortDateString()

+

"

");

Response.Write(DateTime.Now.ToShortTimeString()

+

"

");

输出:

2007-1-29

8:49

Response.Write(DateTime.Now.ToLongDateString()

+

"

");

Response.Write(DateTime.Now.ToLongTimeString()

+

"

");

输出:

2007年1月29日

8:49:15

不知合不合你要求

我是要VS2005下使用,很好用。可查看MSDN以下简单例出:

.NET

Framework

类库

DateTime

成员

请参见

构造函数

字段

方法

属性

显式接口实现

全部折叠

全部展开

成员选项:全部显示

成员选项:已筛选

包括继承的成员

包括受保护的成员

.NET

Compact

Framework

成员

表示时间上的一刻,通常以日期和当天的时间表示。

下表列出了由

DateTime

类型公开的成员。

公共构造函数

名称

说明

DateTime

已重载。初始化

DateTime

结构的新实例。

页首

公共字段

名称

说明

MaxValue

表示

DateTime

的最大可能值。此字段为只读。

MinValue

表示

DateTime

的最小可能值。此字段为只读。

页首

公共属性

名称

说明

Date

获取此实例的日期部分。

Day

获取此实例所表示的日期为该月中的第几天。

DayOfWeek

获取此实例所表示的日期是星期几。

DayOfYear

获取此实例所表示的日期是该年中的第几天。

Hour

获取此实例所表示日期的小时部分。

Kind

获取一个值,该值指示由此实例表示的时间是基于本地时间、协调通用时间

(UTC),还是两者皆否。

Millisecond

获取此实例所表示日期的毫秒部分。

Minute

获取此实例所表示日期的分钟部分。

Month

获取此实例所表示日期的月份部分。

Now

获取一个

DateTime

对象,该对象设置为此计算机上的当前日期和时间,表示为本地时间。

Second

获取此实例所表示日期的秒部分。

Ticks

获取表示此实例的日期和时间的刻度数。

TimeOfDay

获取此实例的当天的时间。

Today

获取当前日期。

UtcNow

获取一个

DateTime

对象,该对象设置为此计算机上的当前日期和时间,表示为协调通用时间

(UTC)。

Year

获取此实例所表示日期的年份部分。