Format date of board_startdate

Discussion forum for Extension Writers regarding Extension Development.
User avatar
Stoker 4.0
Registered User
Posts: 1532
Joined: Sun Feb 13, 2011 1:33 pm
Location: Funen, Denmark
Name: Ulrik Christensen

Format date of board_startdate

Post by Stoker 4.0 »

I need help use date format on board_startdate to be displayed like this: 2015/04/14 21:59:59
How can i achieve that?
~ The greatest achievement in life is to inspire ~
Regards Stoker
User avatar
Anișor
Translator
Posts: 361
Joined: Tue Jan 08, 2013 9:36 pm
Location: Angus, Scotland 🏴󠁧󠁢󠁳󠁣󠁴󠁿

Re: Format date of board_startdate

Post by Anișor »

Hmmm ... are you the real Stoker 4.0? Suspicious.
$start_date = $user->format_date($config['board_startdate'], 'Y/m/d H:i:s');
User avatar
Stoker 4.0
Registered User
Posts: 1532
Joined: Sun Feb 13, 2011 1:33 pm
Location: Funen, Denmark
Name: Ulrik Christensen

Re: Format date of board_startdate

Post by Stoker 4.0 »

Anișor wrote: Sun Jan 05, 2025 10:33 am Hmmm ... are you the real Stoker 4.0? Suspicious.
$start_date = $user->format_date($config['board_startdate'], 'Y/m/d H:i:s');
So that stupid a question? :lol:
Its me, quite rusty. I have forgotten a lot....
But thanks ;)
~ The greatest achievement in life is to inspire ~
Regards Stoker
User avatar
Stoker 4.0
Registered User
Posts: 1532
Joined: Sun Feb 13, 2011 1:33 pm
Location: Funen, Denmark
Name: Ulrik Christensen

Re: Format date of board_startdate

Post by Stoker 4.0 »

Just an update.
The problem vas usiing this in the $this->template->assign_vars(array(

Code: Select all

'START_DATE' => $start_date,
which allways will return: 12 May 2008, 23:26

but using this:

Code: Select all

$start_date				= date('Y/m/d H:i:s', $this->config['board_startdate']);
and

Code: Select all

'PORTAL_START_DATE' => $start_date,
returns what I wanted: 2008/05/12 21:26:28
~ The greatest achievement in life is to inspire ~
Regards Stoker
User avatar
Steve
Registered User
Posts: 1598
Joined: Tue Apr 07, 2009 7:48 pm
Location: Co. Durham, England
Name: Steven Clark

Re: Format date of board_startdate

Post by Steve »

You can use also: $this->user->format_date($start_date, 'Y/m/d H:i:s', false),
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺

Return to “Extension Writers Discussion”