Join David Gassner for an in-depth discussion in this video Working with dates and times, part of Up and Running with Go.
Dates and times are managed in Go with the time package.…Its time type encapsulates everything…you need for both dates and times, including…math operations, time zones and so on.…There are a few different functions to create time objects.…The date function lets you pass in specific information…for the year, month, day and so on.…The now function returns the current date and time.…The parse function lets you parse a string and so on.…I'll demonstrate a few of these capabilities…in this file, datesAndTimes.go.…
First, I'll import the time package.…Then, in the main function, I'll create a variable…that I'll simply name, t for time…and I'll get its value by calling…the date function, with time.Date.…I'll pass in the year. I'll set it as 2009.…Then I'll use a constant for the month, time.November.…Then I'll pass in 10 for the day of the month,…23 for the hour, 0's for the minutes,…the seconds and the nanoseconds…and a constant of time.UTC for the location.…
Then I'll output that information using fmt.Printf.…I'll use a string of "Go launched at"…
- Installing Go tools
- Creating and compiling a Go workspace
- Exploring variables, constants, and types
- Storing ordered and unordered values
- Grouping related values in structs
- Programming conditional logic and loops
- Defining and calling functions
- Handling errors
- Working with files
- Creating a simple HTTP server
Skill Level Beginner
Using Java to Program Google App Enginewith Patrick Royal2h 4m Intermediate
Google App Engine Essential Trainingwith Joseph Lowery3h 26m Intermediate
1. Getting Started
2. Essential Go Skills
3. Managing Simple Values
4. Managing Complex Types and Collections
5. Managing Program Flow
6. Structuring Go Code
7. Working with Files and the Web
Next steps2m 26s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.