Convert date into word format

后端 未结 5 1674
醉话见心
醉话见心 2021-01-28 05:42

I\'m not sure how i will do it, I want convert date in english word format, like this if date is 10-10-1988 then

In English- tenth October nineteen eighty eight
         


        
5条回答
  •  庸人自扰
    2021-01-28 06:19

    You can refer dobToWords angular library for angular application which can help you out in converting the date object into the words.

    For Example: For date 21-4-1990 it will convert the date into words and will give you output as "Twenty-First April Nineteen Ninety"

        angular.module('sampleApp',[dobToWords])
       .controller('SampleCtrl',['$scope','convertDobToWords',function($scope,convertDobToWords){
            var dateOfBirth = new Date('04/21/1990');
            var dobIntoWords = convertDobToWords.convertIntoWords(dateOfBirth);
            console.log('Date of Birth in Words : '+ dobIntoWords);
         }]);
    

提交回复
热议问题