GithubHelp home page GithubHelp logo

datetime-html's Introduction


deep comprehension of the use of datetime function in html

Why we use the time tag in html?

well this question may comes in your mind that why we use time tag in html to show the time to the users. Although we can show the date or time by any of the text formatting tag in html, html has an specific tag <time></time> to only show the date and time to the user or reader but also to give semantic meaning and make it understandable to computer.

  1. We can give date in any format for human understanding, but for there is an specific format to make it machine readable. The format is: YYYY-MM-DD. The datetime attribute (which is not a global attribute and can only be used in time tag) is used to time in compter readable format.
<time> Feb 17, 2024 </time>
<time datetime="2024-02-17"> Feb 17, 2024 </time>
<time datetime="2024-02-17"> 17 Feb 2024 </time>
<time datetime="2024-02-17"> Feb 17 </time>
  1. We can also give time like this hh-mm-ss and also fractions of seconds like this hh-mm-ss.ddd
<time datetime="07:00"> 7:00 am </time>
<time datetime="20:15"> 8:15 pm </time>
<time datetime="12:30"> afternoon </time>
  1. We can also add time zone in this way__hh-mm-ss.dd+-hh:mm__
<time datetime="14:15-05:00"> 2:15 pm New York time </time>
  1. To give data and time together we can use T or space to seperate date and time.
<time datetime="2024-02-17T07:00-05:00"> 17 Feb 2024, 7:00 am New York Time </time>


<time datetime="2024-02-17 07:00-05:00"> 17 Feb 2024, 7:00 am New York Time </time>

datetime-html's People


idreesishaq avatar



Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.