Yii Framework Forum: Date/Time Formatting - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Date/Time Formatting Rate Topic: -----

#1 User is offline   GSTAR Icon

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 547
  • Joined: 30-October 09
  • Location:Manchester, UK

Posted 08 February 2010 - 07:57 AM

The date/time is stored in a DATETIME field in MySQL (example: 2010-01-15 15:40:20). I would like it displayed as: 15/01/2010 15:40:20 . I know this can be done within the SQL query but this might overcomplicate my queries, therefore I need to do this within the code.

Ideally I just want to specify the formatting in one place and make a call to this function whenever I need to display a formatted date.
0

#2 User is offline   andy_s Icon

  • Random Member Title
  • PipPipPip
  • Group: Members
  • Posts: 546
  • Joined: 22-June 09
  • Location:Russia, Kostroma

Posted 08 February 2010 - 08:10 AM

A combination of PHP functions strtotime() & date() should help.
1

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users