00:00:00
Sponsor
Date/Time
Time
Simple Time Display: Minute, Hour, and Seconds
Instructions
Make sure you have the VisualDX script in your <head>. Checkout the Quick Start for how to do this.
Displaying the Current Time:
- Add the attribute
vdx-time-currenttime
to any element to display the current time. - Use
vdx-time-clock="12-hour"
for 12-hour format orvdx-time-clock="24-hour"
for 24-hour format. - Optionally, specify the timezone with
vdx-time-timezone
.
Example: <div vdx-time-currenttime vdx-time-clock="12-hour" vdx-time-timezone="America/New_York"></div>
Displaying the Current Minute:
- Use
vdx-time-min
in an element to display the current minute. - Customize the display with
vdx-time-display="1-digit"
orvdx-time-display="2-digit"
.
Example: <div vdx-time-min vdx-time-display="2-digit"></div>
Displaying the Current Hour:
- Use
vdx-time-hour
in an element to display the current hour. - Select between 12-hour and 24-hour format using
vdx-time-clock
, and set the digit format usingvdx-time-display
.
Example: <div vdx-time-hour vdx-time-clock="24-hour" vdx-time-display="2-digit"></div>
Displaying the Current Second:
- Use
vdx-time-seconds
in an element to display the current second. - Choose between single-digit and double-digit formatting using
vdx-time-display
.
Example: <div vdx-time-seconds vdx-time-display="2-digit"></div>