导航
  • 主页
  • API 调用
  • 基础类
  • 控件与界面
  • 数据库相关
  • DataWindow
  • 项目管理
  • Web 应用
  • 脚本语言

string(datatime)急!

wuyuchang 2007-12-27 10:48:38
string(datatime)转换后是为什么值?如:string(2007-12-21 12:01:01)结果为多少?
...全文
66 点赞 收藏 6
写回复
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuyuchang 2007-12-27
那我不写格式呢?返回是datetime吗?
回复
jlwei888 2007-12-27
string(2007-12-21 12:01:01,"yyyymmdd") = '20071221'
string(2007-12-21 12:01:01,"yyyymmdd hh:mm:ss") = '20071221 12:01:01'

你想要什么格式,就写什么的参数!
回复
wuyuchang 2007-12-27
返回不是2007-12-21吗?
回复
worldly_wind 2007-12-27
用String(DateTime(2007-12-21 12:01:01))返回2007-12-21 12:01:01
回复
leio 2007-12-27
去查PB联机帮助,可以有很多种格式。

This statement applies a display format to a date value and returns Jan 31, 2002:

String(2002-01-31, "mmm dd, yyyy")

This example applies a format to the value in order_date and sets date1 to 6-11-02:

Date order_date = 2002-06-11

string date1

date1 = String(order_date,"m-d-yy")

This example includes a format for a null date value so that when order_date is null, date1 is set to none:

Date order_date = 2002-06-11

string date1

SetNull(order_date)

date1 = String(order_date, "m-d-yy;'none'")

This statement applies a format to a DateTime value and returns Jan 31, 2001 6 hrs and 8 min:

String(DateTime(2001-01-31, 06:08:00), &

'mmm dd, yyyy h "hrs and" m "min"')

This example builds a DateTime value from the system date and time using the Today and Now functions. The String function applies formatting and sets the text of sle_date to that value, for example, 6-11-02 8:06 pm:

DateTime sys_datetime

string datetime1

sys_datetime = DateTime(Today(), Now())

sle_date.text = String(sys_datetime, &

"m-d-yy h:mm am/pm;'none'")

This statement applies a format to a numeric value and returns $5.00:

String(5,"$#,##0.00")

These statements set string1 to 0123:

integer nbr = 123

string string1

string1 = String(nbr,"0000;(000);****;empty")

These statements set string1 to (123):

integer nbr = -123

string string1

string1 = String(nbr,"000;(000);****;empty")

These statements set string1 to ****:

integer nbr = 0

string string1

string1 = String(nbr,"0000;(000);****;empty")

These statements set string1 to "empty":

integer nbr

string string1

SetNull(nbr)

string1 = String(nbr,"0000;(000);****;empty")

This statement formats string data and returns A-B-C. The display format assigns a character in the source string to each @ and inserts other characters in the format at the appropriate positions:

String("ABC", "@-@-@")

This statement returns A*B:

String("ABC", "@*@")

This statement returns ABC:

String("ABC", "@@@")

This statement returns a space:

String("ABC", " ")

This statement applies a display format to time data and returns 6 hrs and 8 min:

String(06:08:02,'h "hrs and" m "min"')

This statement returns 08:06:04 pm:

String(20:06:04,"hh:mm:ss am/pm")

This statement returns 8:06:04 am:

String(08:06:04,"h:mm:ss am/pm")
回复
jlwei888 2007-12-27
晕!
不知你要什么
string(2007-12-21 12:01:01) 返回 "2007-12-21 12:01:01"
是个string

String是什么的,你知道吗?



你如果还不会就看书吧!
或自己做个试试不就知道了吗?


回复
发动态
发帖子
PowerBuilder
创建于2007-09-28

806

社区成员

PowerBuilder 相关问题讨论
申请成为版主
社区公告
暂无公告