formats.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # This file is distributed under the same license as the Django package.
  2. #
  3. # The *_FORMAT strings use the Django date format syntax,
  4. # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
  5. # Formatting for date objects.
  6. DATE_FORMAT = "N j, Y"
  7. # Formatting for time objects.
  8. TIME_FORMAT = "P"
  9. # Formatting for datetime objects.
  10. DATETIME_FORMAT = "N j, Y, P"
  11. # Formatting for date objects when only the year and month are relevant.
  12. YEAR_MONTH_FORMAT = "F Y"
  13. # Formatting for date objects when only the month and day are relevant.
  14. MONTH_DAY_FORMAT = "F j"
  15. # Short formatting for date objects.
  16. SHORT_DATE_FORMAT = "m/d/Y"
  17. # Short formatting for datetime objects.
  18. SHORT_DATETIME_FORMAT = "m/d/Y P"
  19. # First day of week, to be used on calendars.
  20. # 0 means Sunday, 1 means Monday...
  21. FIRST_DAY_OF_WEEK = 0
  22. # Formats to be used when parsing dates from input boxes, in order.
  23. # The *_INPUT_FORMATS strings use the Python strftime format syntax,
  24. # see https://docs.python.org/library/datetime.html#strftime-strptime-behavior
  25. # Note that these format strings are different from the ones to display dates.
  26. # Kept ISO formats as they are in first position
  27. DATE_INPUT_FORMATS = [
  28. "%Y-%m-%d", # '2006-10-25'
  29. "%m/%d/%Y", # '10/25/2006'
  30. "%m/%d/%y", # '10/25/06'
  31. "%b %d %Y", # 'Oct 25 2006'
  32. "%b %d, %Y", # 'Oct 25, 2006'
  33. "%d %b %Y", # '25 Oct 2006'
  34. "%d %b, %Y", # '25 Oct, 2006'
  35. "%B %d %Y", # 'October 25 2006'
  36. "%B %d, %Y", # 'October 25, 2006'
  37. "%d %B %Y", # '25 October 2006'
  38. "%d %B, %Y", # '25 October, 2006'
  39. ]
  40. DATETIME_INPUT_FORMATS = [
  41. "%Y-%m-%d %H:%M:%S", # '2006-10-25 14:30:59'
  42. "%Y-%m-%d %H:%M:%S.%f", # '2006-10-25 14:30:59.000200'
  43. "%Y-%m-%d %H:%M", # '2006-10-25 14:30'
  44. "%m/%d/%Y %H:%M:%S", # '10/25/2006 14:30:59'
  45. "%m/%d/%Y %H:%M:%S.%f", # '10/25/2006 14:30:59.000200'
  46. "%m/%d/%Y %H:%M", # '10/25/2006 14:30'
  47. "%m/%d/%y %H:%M:%S", # '10/25/06 14:30:59'
  48. "%m/%d/%y %H:%M:%S.%f", # '10/25/06 14:30:59.000200'
  49. "%m/%d/%y %H:%M", # '10/25/06 14:30'
  50. ]
  51. TIME_INPUT_FORMATS = [
  52. "%H:%M:%S", # '14:30:59'
  53. "%H:%M:%S.%f", # '14:30:59.000200'
  54. "%H:%M", # '14:30'
  55. ]
  56. # Decimal separator symbol.
  57. DECIMAL_SEPARATOR = "."
  58. # Thousand separator symbol.
  59. THOUSAND_SEPARATOR = ","
  60. # Number of digits that will be together, when splitting them by
  61. # THOUSAND_SEPARATOR. 0 means no grouping, 3 means splitting by thousands.
  62. NUMBER_GROUPING = 3