没有合适的资源?快使用搜索试试~ 我知道了~
CString,char,int,COleDateTime,CTime,time_t之间的相互转换
![star](https://csdnimg.cn/release/downloadcmsfe/public/img/star.98a08eaa.png)
温馨提示
这些类型的转换在开发数据库应用时很有用,也比较齐全
资源推荐
资源详情
资源评论
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/msword](https://img-home.csdnimg.cn/images/20210720083327.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
给你看下代码:
。。。
while(!m_rec->SSTEOF)
{
var=m_rec->GetCollect("password");
if(var.vt!=NULL)
{
pass=(LPCSTR)_bstr_t(var);
if(pass.Compare(m_Pass)==0)
{
var=m_rec->GetCollect("level");
if(var.vt!=NULL)
{
CString strlevel=(LPCSTR)_bstr_t(var);
int level=atoi(strlevel);
SetOperLeval(level);
}
。。。。
不只到,反正就行了,感谢你的帮助,要是有后遗症还会用你的方法的
来源: http://www.programbbs.com/bbs/view20-5483-1.htm
COleDateTimeoleDate=COleDateTime::GetCurrentTime();
_variant_tvtFld;
vtFld.vt=VT_DATE;
vtFld.date=oleDate;
pRecordSet4->PutCollect("date",vtFld);
读时间值
。。。
while(!m_rec->SSTEOF)
{
var=m_rec->GetCollect("password");
if(var.vt!=NULL)
{
pass=(LPCSTR)_bstr_t(var);
if(pass.Compare(m_Pass)==0)
{
var=m_rec->GetCollect("level");
if(var.vt!=NULL)
{
CString strlevel=(LPCSTR)_bstr_t(var);
int level=atoi(strlevel);
SetOperLeval(level);
}
。。。。
不只到,反正就行了,感谢你的帮助,要是有后遗症还会用你的方法的
来源: http://www.programbbs.com/bbs/view20-5483-1.htm
COleDateTimeoleDate=COleDateTime::GetCurrentTime();
_variant_tvtFld;
vtFld.vt=VT_DATE;
vtFld.date=oleDate;
pRecordSet4->PutCollect("date",vtFld);
读时间值
_bstr_tTheValue=m_pset->Fields->GetItem("出生年月")->Value;
temp=(char*)TheValue;
COleVariantvtime(temp);
vtime.ChangeType(VT_DATE);
COleDateTimetime4=vtime;//读出的是COleDateTime
用下面的方法转换
COleDateTimetime1(1977,4,16,2,2,2);//COleDataTime--->CTime
SYSTEMTIMEsystime;
VariantTimeToSystemTime(time1,&systime);
CTimetm(systime);
http://www.mscto.com
由于Time_t类型是Longint(32bit),TDatetime为Double(64bit)
CString,char*,int,COleDateTime,CTime,time_t之间的相互转换【转】2007-12-22 08:47获取当前时间。
datetime = COleDateTime::GetCurrentTime();
CTime和COleDateTime具有几乎同样的功能。
与CTime相比, COleDateTime的优点在于它支持DWORD变量。
COleDateTime使用的位数是双浮点的两倍,既然CTime只是简单地计算从1970年1月1日之后经过的秒数,所以到了2 0 3 7年它将达到4 2 9 4 9 6 7 2 9 5,从而不能再使用。
//CString--->COleDateTime
COleVariant vtime(strCString);COleDateTime time4=vtime;
//CTime--->time_t
COleDateTime time3(time2);
//time_t--->COleDateTime.
temp=(char*)TheValue;
COleVariantvtime(temp);
vtime.ChangeType(VT_DATE);
COleDateTimetime4=vtime;//读出的是COleDateTime
用下面的方法转换
COleDateTimetime1(1977,4,16,2,2,2);//COleDataTime--->CTime
SYSTEMTIMEsystime;
VariantTimeToSystemTime(time1,&systime);
CTimetm(systime);
http://www.mscto.com
由于Time_t类型是Longint(32bit),TDatetime为Double(64bit)
CString,char*,int,COleDateTime,CTime,time_t之间的相互转换【转】2007-12-22 08:47获取当前时间。
datetime = COleDateTime::GetCurrentTime();
CTime和COleDateTime具有几乎同样的功能。
与CTime相比, COleDateTime的优点在于它支持DWORD变量。
COleDateTime使用的位数是双浮点的两倍,既然CTime只是简单地计算从1970年1月1日之后经过的秒数,所以到了2 0 3 7年它将达到4 2 9 4 9 6 7 2 9 5,从而不能再使用。
//CString--->COleDateTime
COleVariant vtime(strCString);COleDateTime time4=vtime;
//CTime--->time_t
COleDateTime time3(time2);
//time_t--->COleDateTime.
剩余5页未读,继续阅读
![avatar](https://profile-avatar.csdnimg.cn/51f0e0b6e06447bca577d7e8ecd44863_zhangbaidi_wince.jpg!1)
shwill123
- 粉丝: 30
- 资源: 7
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 打包和分发Rust工具.pdf
- SQL中的CREATE LOGFILE GROUP 语句.pdf
- C语言-leetcode题解之第172题阶乘后的零.zip
- C语言-leetcode题解之第171题Excel列表序号.zip
- C语言-leetcode题解之第169题多数元素.zip
- ocr-图像识别资源ocr-图像识别资源
- 图像识别:基于Resnet50 + VGG16模型融合的人体细胞癌症分类模型实现-图像识别资源
- C语言-leetcode题解之第168题Excel列表名称.zip
- C语言-leetcode题解之第167题两数之和II-输入有序数组.zip
- C语言-leetcode题解之第166题分数到小数.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
- 1
- 2
前往页