RestOC.DateTimeHelper module

Date & Time Helper Module

Several useful helper methods for use with dates and times

RestOC.DateTimeHelper.age(dob)

Age

Returns the current age of someone based on today’s date and their DOB. This method is not %100 accurate, but it’s good enough for 99% of cases

Parameters

dob (Arrow|uint|str) – The date of birth of the person

Returns

uint

RestOC.DateTimeHelper.date(d)

Date

Returns a string in YYYY-MM-DD format from a timestamp, date string, or arrow instance

Parameters

d (Arrow|uint|str) – The date to format

Returns

str

RestOC.DateTimeHelper.dateInc(days=1, from_=None)

Date Increment

Returns a date incremented by the given days. Use negative to decrement.

Parameters
  • days (int) – The number of days to increment (or decrement) by

  • from_ (mixed) – Optional, the date to increment from, else today

Returns

arrow.arrow.Arrow

RestOC.DateTimeHelper.datetime(d)

Date Time

Returns a string in YYYY-MM-DD HH:mm:ss format from a timestamp, date string, or arrow instance

Parameters

d (Arrow|uint|str) – The date to format

Returns

str

RestOC.DateTimeHelper.timeElapsed(seconds)

Time Elapsed

Returns seconds in a human readable format

Parameters

seconds (uint) – The seconds to convert to ((HH:)mm:)ss

Returns

str