如何将字符串转换为日期时间格式经典asp [英] How to convert string to datetime format classic asp

查看:77
本文介绍了如何将字符串转换为日期时间格式经典asp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个变量

Dim tt="2008-10-20 10:00:00.0000000"

我想改成日期,

推荐答案

试试CDATE(tt)http://www.w3schools.com/vbscript/func_cdate.asp.我用过

vbscript cdate

vbscript cdate

作为 Google 的关键字.结果更多.

as keywords at Google. There were more results.

基于下面的评论(我很抱歉混淆了),使用

Based on the comment below (I'm sorry for mixing up), using

FormatDateTime(date,format) 

格式包含以下常量:

  • 0 = vbGeneralDate - 默认值.返回日期:mm/dd/yy 和时间 if指定:hh:mm:ss PM/AM.
  • 1 = vbLongDate - 返回日期:工作日、月份名称、年份
  • 2 = vbShortDate - 返回日期:mm/dd/yy
  • 3 = vbLongTime - 返回时间:hh:mm:ss PM/AM
  • 4 = vbShortTime - 返回时间:hh:mm

(复制自 http://www.w3schools.com/vbscript/func_formatdatetime.asp)

这篇关于如何将字符串转换为日期时间格式经典asp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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