perlancar has asked for the wisdom of the Perl Monks concerning the following question:
Can I somehow differentiate between:
DateTime->new(year=>2017, month=>6, day=>16)
and
DateTime->new(year=>2017, month=>6, day=>16, hour=>0, minute=>0, second=>0)
My problem: user might enter 2017-06-16 or 2017-06-16T00:00:00 and in the case of the former I want to set the default for hour/minute/second to 23/59/59 respectively. However, I am checking at a position where the date has been converted to DateTime object.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Detecting whether DateTime object has a time component or not? (updated)
by haukex (Archbishop) on Jun 16, 2017 at 09:19 UTC | |
by perlancar (Hermit) on Jun 16, 2017 at 10:17 UTC | |
by haukex (Archbishop) on Jun 16, 2017 at 16:34 UTC | |
|
Re: Detecting whether DateTime object has a time component or not?
by hippo (Archbishop) on Jun 16, 2017 at 09:17 UTC | |
|
Re: Detecting whether DateTime object has a time component or not?
by Eily (Monsignor) on Jun 16, 2017 at 09:18 UTC | |
by perlancar (Hermit) on Jun 16, 2017 at 10:19 UTC | |
|
Re: Detecting whether DateTime object has a time component or not?
by tobyink (Canon) on Jun 19, 2017 at 15:53 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |