FAQ

Dave Rolsky edited this page Jan 30, 2017 · 3 revisions

Project Administrivia

  • Introduction
  • Searching the DateTime archives
  • Why use DateTime?
  • Where is calendar X?

Basic Usage

  • How do I use DateTime?
  • How do I make a DateTime object?
  • Why do I need to truncate dates?
  • When do I need to clone dates?
  • How do I compare two dates?
  • How do I convert a date from format FOO into a DateTime object (and vice versa)?
  • I printed a date with strftime, how do I parse it again?
  • How can I get a string representing a date?
  • How small an increment of time can I represent?
  • How do I parse multiple formats at once?
  • How do I make a DateTime from a string?

Time Zones

  • What is the floating time zone?
  • If I know my local time, how do I determine the local time in another time zone?
  • How do I change the time zone without changing the local time?
  • Why doesn't DateTime accept the EST time zone?

Date Time Formats

  • How Do I Convert between Epoch Times and DateTime Objects?
  • How Do I Convert between Times from the Perl Builtin Functionality and DateTime Objects?
  • How Do I Convert between POSIX Times and DateTime Objects?
  • How Do I Convert between Time::HiRes and DateTime Objects?
  • How Do I Convert between Times from the TimeDate Family and DateTime Objects?
  • How Do I Convert between Time::Piece Times and DateTime Objects?
  • How Do I Convert between Date::Manip and DateTime Objects?
  • How Do I Convert between Date::Calc Times and DateTime Objects?

Durations, Sets, & Spans

  • What is a DateTime::Duration?
  • What are the three endofmonth modes in DateTime::Duration?
  • What are DateTime::Set objects?
  • How do I get at the dates inside a DateTime::Set?
  • What are the DateTime::Set set operations?
  • Is there an easier way to create sets than writing subroutines?
  • What are DateTime::Span objects?
  • What are DateTime::SpanSet objects?

Sample Calculations

  • How do I check whether a given date lies within a certain range of days?
  • How do I check whether two dates and times lie more or less than a given time interval apart?
  • How do I verify whether someone has a certain age?
  • How can I calculate the day of the week if I want to consider Sunday the first day of the week?
  • How do I calculate the number of the week of month the given date lies in?
  • How do I calculate the date of the Wednesday of the same week as the current date?
  • How do I calculate the last and the next Saturday for any given date?
  • How can I calculate the last business day (payday!) of a month?
  • How can I find what day the third Friday of a month is on?
  • How can I iterate through a range of dates?
  • How can I create a list of dates in a certain range?
  • How can I calculate the difference in days between dates?
  • How can I calculate the difference between two times, but without counting Saturdays and Sundays or calculate business time between two times?
  • How do I find yesterday's Date?

Miscellaneous

  • How do I do business week calculations?
  • How do I localize dates?
  • What are with GMT, TAI, UTC, and UT1?
  • How does DST affect day length?