• 0

Need HTML code to automatically change the date!


Question

10 answers to this question

Recommended Posts

  • 0
  disturb3d said:

Maybe this will help you

http://uk2.php.net/date

AFAIK theres no way to do it in HTML

Yea...sorry if I sound like an idiot...but I tried that, and well, I have no clue how to implement that.

Would you mind posting the exact code (so I can copy+paste) in here for me to have it formatted like I have it?

I know that is asking a lot, and if you don't want to or can't, that is fine. Either way, thanks for the link and trying to help!

  • 0

<?php
$today = date("m.d.y"); 
//replace the current static date with
echo = ("$today");
?>

^ That should work. I've never done active time/date stuff before but try it. Keep it mind that the variable ($today) and the echo statement should both be inside php tags (<?php, ?>)

Im not sure how clear that is to you, let me know.

  • 0
  disturb3d said:

&lt;?php
$today = date("m.d.y"); 
//replace the current static date with
echo = ("$today");
?&gt;

^ That should work. I've never done active time/date stuff before but try it. Keep it mind that the variable ($today) and the echo statement should both be inside php tags (<?php, ?>)

Im not sure how clear that is to you, let me know.

I must be mentally retarded...I copied+pasted that in the code...got nothing.

  • 0

Your file extension has to be .php

You would have to use javascript if you wanted to keep the .html or .htm

Thats PHP code he gave you. You can copy/paste that and it will work if..

* You insert it into a PHP file filename.php

* Your server has PHP installed.

  • 0

if you're still having trouble with this let me know... I know there's gotta be a simple way to do this with Javascript and it'd be an interesting learning project for myself :yes:

Check this one out, it looks like what you're talking about:

http://dynamicdrive.com/dynamicindex6/clock3.htm

  • 0

Try the code bellow... it works like it does on www.hp.com

copy the code bellow to your page.

&lt;script LANGUAGE = "JavaScript"&gt;

&lt;!--

// Array of day names

var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

var monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

var dt = new Date();

var y  = dt.getYear();

// Y2K compliant

if (y &lt; 1000) y +=1900;

// --&gt;

&lt;/script&gt;

add the code bellow where you want your date to show.

&lt;script type="text/javascript" language="JavaScript"&gt;document.write(monthNames[dt.getMonth()] + " " + dt.getDate() + ", " + y);&lt;/script&gt; &lt;/div&gt;

Also, see example HTML attachment

date_example.htmlFetching info...

  • 0
  Juguard said:

Try the code bellow... it works like it does on www.hp.com

copy the code bellow to your page.

&lt;script LANGUAGE = "JavaScript"&gt;

&lt;!--

// Array of day names

var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

var monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

var dt = new Date();

var y  = dt.getYear();

// Y2K compliant

if (y &lt; 1000) y +=1900;

// --&gt;

&lt;/script&gt;

add the code bellow where you want your date to show.

&lt;script type="text/javascript" language="JavaScript"&gt;document.write(monthNames[dt.getMonth()] + " " + dt.getDate() + ", " + y);&lt;/script&gt; &lt;/div&gt;

Also, see example HTML attachment

Thanks so much! This worked perfectly! I appreciate everyone's help!

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • What? Every single app I've installed from the Microsoft Store comes from its intended developer and works perfectly fine. What apps do you install?
    • Microsoft Store is such a weird place filled with so much absolute garbage and with reputable apps that somehow come from questionable sources. Like, the app name is known, the images back it up but the publisher is just some weird name that's not mentioned for the apps we know.
    • NTLite 2025.06.10459 is out.
    • Wireshark 4.4.7 by Razvan Serea  Wireshark is a network packet analyzer. A network packet analyzer will try to capture network packets and tries to display that packet data as detailed as possible. You could think of a network packet analyzer as a measuring device used to examine what's going on inside a network cable, just like a voltmeter is used by an electrician to examine what's going on inside an electric cable (but at a higher level, of course). In the past, such tools were either very expensive, proprietary, or both. However, with the advent of Wireshark, all that has changed. Wireshark is perhaps one of the best open source packet analyzers available today. Deep inspection of hundreds of protocols, with more being added all the time Live capture and offline analysis Standard three-pane packet browser Multi-platform: Runs on Windows, Linux, OS X, Solaris, FreeBSD, NetBSD, and many others Captured network data can be browsed via a GUI, or via the TTY-mode TShark utility The most powerful display filters in the industry Rich VoIP analysis Read/write many different capture file formats Capture files compressed with gzip can be decompressed on the fly Live data can be read from Ethernet, IEEE 802.11, PPP/HDLC, ATM, Bluetooth, USB, Token Ring, Frame Relay, FDDI, and others (depending on your platfrom) Decryption support for many protocols, including IPsec, ISAKMP, Kerberos, SNMPv3, SSL/TLS, WEP, and WPA/WPA2 Coloring rules can be applied to the packet list for quick, intuitive analysis Output can be exported to XML, PostScript®, CSV, or plain text Wireshark 4.4.7 changelog: The following vulnerabilities have been fixed wnpa-sec-2025-02 Dissection engine crash. Issue 20509. CVE-2025-5601. The following bugs have been fixed Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. Issue 20463. Dissector bug, Protocol CIGI. Issue 20496. Green power packets are not dissected when proto_version == ZBEE_VERSION_GREEN_POWER. Issue 20497. Packet diagrams misalign or drop bitfields. Issue 20507. Corruption when setting heuristic dissector table UI name from Lua. Issue 20523. LDAP dissector incorrectly displays filters with singleton "&" Issue 20527. WebSocket per-message compression extentions: fail to decompress server messages (from the 2nd) due to parameter handling. Issue 20531. The LL_PERIODIC_SYNC_WR_IND packet is not properly dissected (packet-btle.c) Issue 20554. Updated Protocol Support AT, BT LE LL, CIGI, genl, LDAP, LIN, Logcat Text, net_dm, netfilter, nvme, SSH, TCPCL, TLS, WebSocket, ZigBee, and ZigBee ZCL Download: Wireshark 4.4.7 | 83.2 MB (Open Source) Download: Portable Wireshark 4.4.7 | ARM64 Installer View: Wireshark Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Snapchat finally has a watchOS app, a decade after the Apple Watch launched by David Uzondu Snap has announced that Snapchat is finally hopping onto Apple Watch, something many users have probably been waiting for. This new app lets you easily preview an incoming message right on your wrist and then fire back a reply without ever needing to grab your iPhone. For those quick responses, you have options: you can tap out a message on the keyboard, use Scribble to draw letters, dictate your reply, or just send a fitting emoji. Snap says it's trying to make Snapchat easier to use on all the different devices people have in their lives. It's already seen people using Snapchat on tablets and the web, so bringing it to wearables like the Apple Watch feels like the next natural move. That marks a big change from back in 2015 when the Apple Watch first launched. At the time, Snap took a more cautious "wait and see" approach, wanting to see if people actually used smartwatches before building an app. New app launches are not always perfect. It is still early days for the watchOS app, as some users on Reddit have reported the app being stuck on the loading screen. Hopefully, Snap will address these initial teething problems quickly. This expansion to Apple Watch comes after the company abandoned its widely criticized three-tab app redesign following a notable drop in its North American daily active users and significant negative feedback. That redesign, introduced back in September 2024, was meant to simplify things but ended up frustrating many, leading Snap to reverse course after about seven months and work on a refined five-tab layout. Meanwhile, Android smartwatch users with Wear OS are still in a different boat, as there is no official, dedicated Snapchat app for that platform yet. They can typically only receive notifications, and attempts to sideload the full Android app often result in a clunky experience.
  • Recent Achievements

    • Week One Done
      CHUNWEI earned a badge
      Week One Done
    • One Year In
      survivor303 earned a badge
      One Year In
    • Week One Done
      jbatch earned a badge
      Week One Done
    • First Post
      Yianis earned a badge
      First Post
    • Rookie
      GTRoberts went up a rank
      Rookie
  • Popular Contributors

    1. 1
      +primortal
      419
    2. 2
      +FloatingFatMan
      182
    3. 3
      snowy owl
      181
    4. 4
      ATLien_0
      174
    5. 5
      Xenon
      138
  • Tell a friend

    Love Neowin? Tell a friend!