Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Time Package – Parsing, For | Go Programming Bootcamp lesson | BraveProgrammer
  1. Courses
  2. /
  3. Go Programming Bootcamp

Lesson 35 of 60

·Go

Time Package – Parsing, Formatting, and Timers

15 minutes

Course progress58%

Working with Time

This lesson explains the main concept clearly with beginner-friendly examples and background so you can learn why the code works.

now := time.Now()
fmt.Println(now.Format(time.RFC3339))

// Parse ISO‑8601
t, err := time.Parse(time.RFC3339, "2024-03-25T12:34:56Z")

// Timer & After
timer := time.NewTimer(2 * time.Second)
<-timer.C // blocks for 2 s

Tickers (periodic actions)

ticker := time.NewTicker(1 * time.Second)
defer ticker.Stop()
for range ticker.C {
    fmt.Println("tick")
}

Timezones

loc, _ := time.LoadLocation("America/New_York")
nyc := now.In(loc)

Info

Always use time.Now().UTC() when persisting timestamps to a database.
Make it stickPractice what you've learned1 quiz · 3 practical tests · Optional activities from Go Programming BootcampBrowse activities
Previous lessonFile System Operations with `os` and `io/ioutil`Continue to lesson 36Encoding & Decoding – JSON, XML, and GobBack to Go Programming Bootcamp curriculum