Qcodo date format


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /**
  2. * Outputs the date as a string given the format strFormat. By default,
  3. * it will return as QDateTime::FormatDisplayDate "MMM DD YYYY", e.g. Mar 20 1977.
  4. *
  5. * Properties of strFormat are (using Sunday, March 2, 1977 at 1:15:35 pm
  6. * in the following examples):
  7. *
  8. * M - Month as an integer (e.g., 3)
  9. * MM - Month as an integer with leading zero (e.g., 03)
  10. * MMM - Month as three-letters (e.g., Mar)
  11. * MMMM - Month as full name (e.g., March)
  12. *
  13. * D - Day as an integer (e.g., 2)
  14. * DD - Day as an integer with leading zero (e.g., 02)
  15. * DDD - Day of week as three-letters (e.g., Wed)
  16. * DDDD - Day of week as full name (e.g., Wednesday)
  17. *
  18. * YY - Year as a two-digit integer (e.g., 77)
  19. * YYYY - Year as a four-digit integer (e.g., 1977)
  20. *
  21. * h - Hour as an integer in 12-hour format (e.g., 1)
  22. * hh - Hour as an integer in 12-hour format with leading zero (e.g., 01)
  23. * hhh - Hour as an integer in 24-hour format (e.g., 13)
  24. * hhhh - Hour as an integer in 24-hour format with leading zero (e.g., 13)
  25. *
  26. * mm - Minute as a two-digit integer
  27. *
  28. * ss - Second as a two-digit integer
  29. *
  30. * z - "pm" or "am"
  31. * zz - "PM" or "AM"
  32. * zzz - "p.m." or "a.m."
  33. * zzzz - "P.M." or "A.M."
  34. *
  35. * ttt - Timezone as a three-letter code (e.g. GMT)
  36. *
  37. * @param string $strFormat the format of the date
  38. * @return string the formatted date as a string
  39. */

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.