Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 2 Years, 11 Months ago Month and Date
#1
Solved: 2 Years, 11 Months ago
Hello everyone, I have some questions regarding M (month) and d (Date)
so I have a portal page which shows recent threads, and I made a small box which shows is supposed to show the M and d (php)
I have tried many ways to get the thread creation M and d, but there is no way possible
I tried making a variable:

$annmonth = my_date(M);
This code shows the real-time month, not the thread creation month.
Also:

$annmonth = my_date(d);
shows the whole thing (date, month, time, yesterday or whatever)
Is there anyway to get only the month and date of the thread?
Reply
#2
Solved: 2 Years, 11 Months ago
Why not just do

// Returns for example: 11-30-2016, 07:53 PM or 3 hours ago
$annmonth = my_date('relative', $thread['dateline']);
Reply
#3
Solved: 2 Years, 11 Months ago
First of all the portal page contains $announcements['dateline']
Second of all the code you pasted above isn't working unfortunately
BUT, thank you so much for having your time and and sorry but it didn't work,
Any other way?
Reply
#4
Solved: 2 Years, 11 Months ago
(12-04-2016, 03:27 PM)JoblessCat Wrote: I have tried many ways to get the thread creation M and d, but there is no way possible
I tried making a variable:

$annmonth = my_date(M);
This code shows the real-time month, not the thread creation month.
Also:

$annmonth = my_date(d);
shows the whole thing (date, month, time, yesterday or whatever)
Is there anyway to get only the month and date of the thread?

Because you haven't given it a date to format, so it just uses the current date.

You need to pass through the date you actually want to format as the second parameter:

$month = my_date('M', $announcements['dateline']);
$day = my_date('d', $announcements['dateline']);
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
Reply
#5
Solved: 2 Years, 11 Months ago
Thank you so much it worked, also for the fast reply
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)