PDA

View Full Version : Today's Date: Anywhere you want!


King Kovifor
04 Jan 2006, 01:21
Plugin today's date anywhere in the system. Just place the following JAVASCRIPT in the HTML Code.

<script language="JavaScript">
<!--
function makeArray() {
for (i = 0; i<makeArray.arguments.length; i++)
this[i + 1] = makeArray.arguments[i];
}
function makeArray0() {
for (i = 0; i<makeArray0.arguments.length; i++)
this[i] = makeArray0.arguments[i];
}
function y2k(number) {
return (number < 1000) ? number + 1900 : number;
}
var months = new makeArray('January','February','March','April','May','June','July','August','Sep tember','October','November','December');
var days = new makeArray0('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday ');
var today = new Date();
var day = days[today.getDay()];
var date = today.getDate();
var month = today.getMonth() + 1;
var year = y2k(today.getYear());
//-->
</script>

Different Version: http://www.vbulletin.org/forum/showpost.php?p=864146&postcount=4

Note:

Java taken from freeservers site. I take NO Credit once so ever, it's just instructions.

Snake
04 Jan 2006, 11:33
Thanks, works just fine! :)

Allan
04 Jan 2006, 11:47
Screen please :)

jugo
04 Jan 2006, 11:58
Wouldn't a plugin using php's


date();


function work just as well....

then set that to a variable and insert it wherever you want.

EDIT: this is for jilly - as requested in PM: (don't mean to be rude and steal your thread, so please let me know if you want me to move this post.)

Install this plugin and insert

$today

wherever you want to display the date and time.

You can change the display of the date and time by editing the plugin:


$today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm
$today = date("m.d.y"); // 03.10.01
$today = date("j, n, Y"); // 10, 3, 2001
$today = date("Ymd"); // 20010310
$today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // It is the 10th day.
$today = date("D M j G:i:s T Y"); // Sat Mar 10 15:16:08 MST 2001
$today = date("H:i:s"); // 17:16:17

Rich
04 Jan 2006, 12:38
Hello,

Just to make sure no one gets in trouble, did you get this script from Dynamic Drive? If you did, and you removed their copyright, people can get in trouble for using it with the copyright stripped.

King Kovifor
08 Jan 2006, 22:21
Hello,

Just to make sure no one gets in trouble, did you get this script from Dynamic Drive? If you did, and you removed their copyright, people can get in trouble for using it with the copyright stripped.

Nope, what's Dynamic Drive?

ChurchMedia
09 Jan 2006, 05:49
Wouldn't a plugin using php's


Code:
date();

function work just as well....

then set that to a variable and insert it wherever you want.



I tried it your way and it just shows up as yyyy-mm-dd (2006-01-08) on the FORUM HOME page. It's fine on other pages...

Ideas?

Paul M
09 Jan 2006, 08:23
The date and time are already available anywhere in vb as $datenow and $timenow (formatted as per your vb options). The year is also available as $copyrightyear.

King Kovifor
10 Jan 2006, 19:09
The date and time are already available anywhere in vb as $datenow and $timenow (formatted as per your vb options). The year is also available as $copyrightyear.
I did not know that. Thanks.

radiofranky
26 Jul 2011, 00:03
The date and time are already available anywhere in vb as $datenow and $timenow (formatted as per your vb options). The year is also available as $copyrightyear.


Hi,
I tried putting {vb:raw datenow} in my vb4.14 template but nothing is showing up.

thanks