メインコンテンツまでスキップ
バージョン:25.2

convert

  • command
  • Use of the convert command to convert a value to a different unit was introduced in 1.67
  • The convert command is used to convert dates and times to different formats, or to convert a numeric value with a unit to a different measurement unit. Date and time formats supported include: the date, short date, abbreviated date, long date, time, short time, abbreviated time, long time, local time, short local time, abbreviated local time, long local time, seconds, short seconds, abbreviated seconds, long seconds, dateitems, internet date, long internet date, abbreviated internet date, short internet date, international date, long international date, abbreviated international date, short international date, international time, long international time, abbreviated international time, and short international time.

    

  • The convert command produces a formatted date/time value rather than a simple text string (except for "seconds" formats). This preserves formatting information through date arithmetic operations. The seconds formats have no corresponding format, so converting to seconds, long seconds, etc. will still result in a fixed text string rather than a formatted time value.
  • A value in a variable can be converted to another unit type using the convert command:
         put 18 inches into length
put length -- 18 inches
convert length to ft
put length -- 1.5 feet