• Kevin Burke's avatar
    time: show how to get midnight on the current day · e1ced321
    Kevin Burke authored
    A common task is trying to get today's date in the local time zone
    with zero values for the hour, minute, second, and nanosecond fields.
    I tried this recently and incorrectly used Truncate(24*time.Hour),
    which truncates based on a UTC clock, and gave me 5pm Pacific time
    instead of midnight Pacific.
    
    I thought it would be helpful to show a "correct" way to do this.
    
    Change-Id: I479e6b0cc56367068530981ca69882b34febf945
    Reviewed-on: https://go-review.googlesource.com/46833Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    e1ced321
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...