string(datatime)急!

wuyuchang 2007-12-27 10:48:38
string(datatime)转换后是为什么值?如:string(2007-12-21 12:01:01)结果为多少?
...全文
106 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
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是什么的,你知道吗?



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


1,108

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧