Announcement

Collapse
No announcement yet.

Get year in two digits?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Get year in two digits?

    How to get year in two digits ? Example for 2003 to get 03 ?
    I use:

    var year=mydate.getYear()

    but this returns four digits year ?

  • #2
    First of all, use getFullYear(), it is truly y2k safe.

    2nd, just do:

    new Date().getFullYear().toString().substring(2,4)

    to get the last 2 numbers.

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...
    X