Hi there.
How to add leading zero at the front of month and day field. For example,
From 2018/6/6 to 2018/06/06 YYYYMMDD
Normally we would use datetimepicker.js for the job. What if it did not show the leading zero at front of the month or day. We can add revise it by using -slide(-2) function and by if condition
Method 1: Slice(-2) function
How to add leading zero at the front of month and day field. For example,
From 2018/6/6 to 2018/06/06 YYYYMMDD
Normally we would use datetimepicker.js for the job. What if it did not show the leading zero at front of the month or day. We can add revise it by using -slide(-2) function and by if condition
Method 1: Slice(-2) function
Method 2: If condition
Hope it helps and happy coding.
No comments:
Post a Comment