Ticket #39973

Format functionality in datetime mods

Open Date: 2020-02-01 14:50 Last Update: 2020-11-25 02:09

Reporter:
Owner:
Status:
Closed
Component:
(None)
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
None
File:
None

Details

Format functionality should be added to datetime mods

Ticket History (3/8 Histories)

2020-02-01 14:50 Updated by: miyakawataku
  • New Ticket "Format functionality in datetime mods" created
2020-11-05 18:05 Updated by: miyakawataku
  • Owner Update from (None) to miyakawataku
2020-11-05 21:17 Updated by: miyakawataku
Comment

Example:

stdout.print_line(Odt.show{(:C) C.spec('[year]-[month]-[day]T[hour24]:[minute]:[second][offset]') })
stdout.print_line(Odt.show{(:C) C.spec('[year short]-[month pad0]-[day]T[hour24]:[minute]:[second][offset colon Z]') })
(Edited, 2020-11-05 23:20 Updated by: miyakawataku)
2020-11-05 23:18 Updated by: miyakawataku
Comment
  • year
    • full (default) / short
  • month
    • num (default) / name
    • pad0 (default) / nopad
    • full (default) / short
  • day
    • pad0 (default) / nopad
  • day_of_week
    • full (default) / short
  • hour
    • pad0 (default) / nopad
    • 0-23 (default) / 1-12
  • ampm
  • minute
    • pad0 (default) / nopad
  • second
    • pad0 (default) / nopad
    • scale0 (default) / scale1 / scale2 / scale3 / scale4 / scale5 / scale6 / scale7 / scale8 / scale9
  • offset
    • plus0 (default) / minus0 / Z
    • colon (default) / nocolon
(Edited, 2020-11-08 17:29 Updated by: miyakawataku)
2020-11-20 00:08 Updated by: miyakawataku
Comment

Formatting should be handled by FORMAT.format.

:OFFSET_DATETIME.require_from('kink/datetime/')
:FORMAT.require_from('kink/')

:Odt <- OFFSET_DATETIME.new(1982 1 23 1 23 45.987654321 OFFSET.new(- (3 * 60 + 30)))
:Msg <- 'hey ho'

stdout.print_line(
  FORMAT.format('{Odt} -- {Msg}'){(:C)
    C.named_args('Odt' Odt 'Msg' Msg)
  }
) # => 1982-01-23T01:23:45.987654321-03:30 -- hey ho

stdout.print_line(
  FORMAT.format('{Odt%year} / {Odt%month} / {Odt%day} -- {Msg}'){(:C)
    C.named_args('Odt' Odt 'Msg' Msg)
  }
) # => 1982 / 01 / 23 -- hey ho
2020-11-22 10:35 Updated by: miyakawataku
Comment

Working on issue_0039973-datetime-format

2020-11-23 16:02 Updated by: miyakawataku
Comment
  • year
    • 0001-9999 (default)
    • 01-99
  • month
    • 01-12 (default)
    • 1-12
    • January
    • Jan
  • day
    • 01-31 (default)
    • 1-31
  • day_of_week
    • Monday (default)
    • Mon
  • ampm
  • hour
    • 00-23 (default)
    • 0-23
    • 1-12
  • minute
  • second
    • .0 .1 .2 ... .9 (default)
  • offset
    • +0 (default)
    • Z
    • 00:00 (default)
    • 0000
(Edited, 2020-11-23 16:16 Updated by: miyakawataku)
2020-11-25 02:09 Updated by: miyakawataku
  • Status Update from Open to Closed
Comment

Closed by 4a0634228c6c8e374bf211d6d6f884bfac10f484

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login