10808 Posts in 2494 Topics by 1782 members
|Go to End|
3 March 2010 at 11:12am
Wasn't sure what topic to put this in - I'm using userpage but this is actually a problem I'm experiencing after customizing it.
I'm having a difficult time with date output in the back-end. It's probably a simple solution, but my mind has been spinning for hours trying to solve it. So hopefully someone can help me. I'm using userpage module for registering users. I want to display the date the user has registered in the member's profile that is seen by the admin (under Security & viewing user details). I have finally been able to have the date displayed in US format (m/d/Y). The problem I am having is the relative time is showing up when logged in as admin & it is wrong.
Example: If I register today, March 2, 2010, the date automatically is displayed as 03/02/2010 (this is displayed both in the front-end of the site at the user's profile & in the back-end under Security, when viewing user's details as admin). However, in the back-end it also displays the relative time, so it says "03/02/2010, 2 months ago". (It does not list the relative time in the user's profile on the front-end).
I would be happy with a solution that either makes the relative date correct (which should be "Today"), or one that removes the relative date from appearing in the back-end. But I can't seem to get a solution on my own.
I'm currently using the Database field type Date & I'm using this in onBeforeWrite():
$this->DateRegistered = date('m/d/Y');
5 March 2010 at 8:36pm Last edited: 5 March 2010 8:37pm
I finally got the date to show correctly (in US format) AND get the relative date to match. After taking some time to clear my mind, I found this post & followed SmartPlugsDesign's instructions for better US localization. I did have to change my bit of code that I posted previously to "d/m/Y" in order for it to display "m/d/Y":
$this->DateRegistered = date('d/m/Y');
But it works & now displays "03/05/2010 (today)"!
|Go to Top|