Skip to content

ZonedDateTime and OffsetDateTime could do with Date and Time properties #186

@GoogleCodeExporter

Description

@GoogleCodeExporter
> What situation does this request make simpler?

Avoiding long property chains for little purpose.

To find out today's date in a particular zone, I currently have to use:

    var date = clock.Now.InZone(zone).LocalDateTime.Date;

Ditto for time of day.

Three options suggest themselves:

1) var date = clock.Now.InZone(zone).Date;
2) var date = clock.Now.InZone(zone).LocalDate;
3) var date = clock.Now.InZone(zone).Local.Date;

In the first two options it would be adding new properties to ZonedDateTime - 
either Date and Time, or LocalDate and LocalTime. In the third option it would 
be adding "Local" as a synonym for "LocalDateTime", which works nicely here but 
is a little bleh. Whatever we do for ZonedDateTime we should do for 
OffsetDateTime too.

I *think* I prefer option 1, but equally emphasizing the "local" part is nice 
too...

Original issue reported on code.google.com by jonsk...@google.com on 30 Jan 2013 at 11:25

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions