StartOf.sql 803 B

1234567891011121314151617181920
  1. /* syntax version 1 */
  2. $format = DateTime::Format("%Y-%m-%d %H:%M:%S %Z");
  3. select
  4. $format(DateTime::StartOfYear(`tztimestamp`)),
  5. $format(DateTime::StartOfQuarter(`tztimestamp`)),
  6. $format(DateTime::StartOfMonth(`tztimestamp`)),
  7. $format(DateTime::StartOfWeek(`tztimestamp`)),
  8. $format(DateTime::StartOfDay(`tztimestamp`)),
  9. $format(DateTime::StartOf(`tztimestamp`, Interval("PT13H"))),
  10. $format(DateTime::StartOf(`tztimestamp`, Interval("PT4H"))),
  11. $format(DateTime::StartOf(`tztimestamp`, Interval("PT15M"))),
  12. $format(DateTime::StartOf(`tztimestamp`, Interval("PT20S"))),
  13. $format(DateTime::StartOf(`tztimestamp`, Interval("PT7S"))),
  14. DateTime::TimeOfDay(`tztimestamp`)
  15. from (
  16. select
  17. cast(ftztimestamp as TzTimestamp) as `tztimestamp`
  18. from Input
  19. );