How can i get this difference between two dates in swift? [duplicate]












0
















This question already has an answer here:




  • Getting the difference between two NSDates in (months/days/hours/minutes/seconds)

    17 answers



  • Swift iOS doesRelativeDateFormatting have different values besides “Today” and “Yesterday”?

    3 answers




i follow this answer but not suitable answer for me it was count total days ,total year or month but i want to get output like below.



Two dates is below :




  • 2018-11-24 05:46:14 +0000 Today date


  • 2008-10-06 00:00:00 +0000 registration date



In the above date I wan't to get the difference today date to registration date and get output like




10 years 1 Months and 18 days




. So, how i can get this type output in swift please help me or any suggestion for it.



Thank You.










share|improve this question















marked as duplicate by matt ios
Users with the  ios badge can single-handedly close ios questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 6:00


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    i want to use stackoverflow.com/questions/27182023/… but there is total diffrence output not usable for me

    – jinal rakholiya
    Nov 24 '18 at 6:02











  • you can try this 3rd party library and then look into how they compute this. Keep in mind dates are grounded by their time zone, etc. github.com/malcommac/SwiftDate

    – Alex Bailey
    Nov 24 '18 at 6:34











  • Follow this answer for your result: stackoverflow.com/a/53455884/1673192

    – iDev750
    Nov 24 '18 at 6:53











  • stackoverflow.com/a/32302797/2303865

    – Leo Dabus
    Nov 24 '18 at 10:34











  • stackoverflow.com/a/27337951/2303865

    – Leo Dabus
    Nov 24 '18 at 10:36
















0
















This question already has an answer here:




  • Getting the difference between two NSDates in (months/days/hours/minutes/seconds)

    17 answers



  • Swift iOS doesRelativeDateFormatting have different values besides “Today” and “Yesterday”?

    3 answers




i follow this answer but not suitable answer for me it was count total days ,total year or month but i want to get output like below.



Two dates is below :




  • 2018-11-24 05:46:14 +0000 Today date


  • 2008-10-06 00:00:00 +0000 registration date



In the above date I wan't to get the difference today date to registration date and get output like




10 years 1 Months and 18 days




. So, how i can get this type output in swift please help me or any suggestion for it.



Thank You.










share|improve this question















marked as duplicate by matt ios
Users with the  ios badge can single-handedly close ios questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 6:00


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    i want to use stackoverflow.com/questions/27182023/… but there is total diffrence output not usable for me

    – jinal rakholiya
    Nov 24 '18 at 6:02











  • you can try this 3rd party library and then look into how they compute this. Keep in mind dates are grounded by their time zone, etc. github.com/malcommac/SwiftDate

    – Alex Bailey
    Nov 24 '18 at 6:34











  • Follow this answer for your result: stackoverflow.com/a/53455884/1673192

    – iDev750
    Nov 24 '18 at 6:53











  • stackoverflow.com/a/32302797/2303865

    – Leo Dabus
    Nov 24 '18 at 10:34











  • stackoverflow.com/a/27337951/2303865

    – Leo Dabus
    Nov 24 '18 at 10:36














0












0








0


0







This question already has an answer here:




  • Getting the difference between two NSDates in (months/days/hours/minutes/seconds)

    17 answers



  • Swift iOS doesRelativeDateFormatting have different values besides “Today” and “Yesterday”?

    3 answers




i follow this answer but not suitable answer for me it was count total days ,total year or month but i want to get output like below.



Two dates is below :




  • 2018-11-24 05:46:14 +0000 Today date


  • 2008-10-06 00:00:00 +0000 registration date



In the above date I wan't to get the difference today date to registration date and get output like




10 years 1 Months and 18 days




. So, how i can get this type output in swift please help me or any suggestion for it.



Thank You.










share|improve this question

















This question already has an answer here:




  • Getting the difference between two NSDates in (months/days/hours/minutes/seconds)

    17 answers



  • Swift iOS doesRelativeDateFormatting have different values besides “Today” and “Yesterday”?

    3 answers




i follow this answer but not suitable answer for me it was count total days ,total year or month but i want to get output like below.



Two dates is below :




  • 2018-11-24 05:46:14 +0000 Today date


  • 2008-10-06 00:00:00 +0000 registration date



In the above date I wan't to get the difference today date to registration date and get output like




10 years 1 Months and 18 days




. So, how i can get this type output in swift please help me or any suggestion for it.



Thank You.





This question already has an answer here:




  • Getting the difference between two NSDates in (months/days/hours/minutes/seconds)

    17 answers



  • Swift iOS doesRelativeDateFormatting have different values besides “Today” and “Yesterday”?

    3 answers








ios swift date






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 6:05







jinal rakholiya

















asked Nov 24 '18 at 5:56









jinal rakholiyajinal rakholiya

253




253




marked as duplicate by matt ios
Users with the  ios badge can single-handedly close ios questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 6:00


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by matt ios
Users with the  ios badge can single-handedly close ios questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 6:00


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1





    i want to use stackoverflow.com/questions/27182023/… but there is total diffrence output not usable for me

    – jinal rakholiya
    Nov 24 '18 at 6:02











  • you can try this 3rd party library and then look into how they compute this. Keep in mind dates are grounded by their time zone, etc. github.com/malcommac/SwiftDate

    – Alex Bailey
    Nov 24 '18 at 6:34











  • Follow this answer for your result: stackoverflow.com/a/53455884/1673192

    – iDev750
    Nov 24 '18 at 6:53











  • stackoverflow.com/a/32302797/2303865

    – Leo Dabus
    Nov 24 '18 at 10:34











  • stackoverflow.com/a/27337951/2303865

    – Leo Dabus
    Nov 24 '18 at 10:36














  • 1





    i want to use stackoverflow.com/questions/27182023/… but there is total diffrence output not usable for me

    – jinal rakholiya
    Nov 24 '18 at 6:02











  • you can try this 3rd party library and then look into how they compute this. Keep in mind dates are grounded by their time zone, etc. github.com/malcommac/SwiftDate

    – Alex Bailey
    Nov 24 '18 at 6:34











  • Follow this answer for your result: stackoverflow.com/a/53455884/1673192

    – iDev750
    Nov 24 '18 at 6:53











  • stackoverflow.com/a/32302797/2303865

    – Leo Dabus
    Nov 24 '18 at 10:34











  • stackoverflow.com/a/27337951/2303865

    – Leo Dabus
    Nov 24 '18 at 10:36








1




1





i want to use stackoverflow.com/questions/27182023/… but there is total diffrence output not usable for me

– jinal rakholiya
Nov 24 '18 at 6:02





i want to use stackoverflow.com/questions/27182023/… but there is total diffrence output not usable for me

– jinal rakholiya
Nov 24 '18 at 6:02













you can try this 3rd party library and then look into how they compute this. Keep in mind dates are grounded by their time zone, etc. github.com/malcommac/SwiftDate

– Alex Bailey
Nov 24 '18 at 6:34





you can try this 3rd party library and then look into how they compute this. Keep in mind dates are grounded by their time zone, etc. github.com/malcommac/SwiftDate

– Alex Bailey
Nov 24 '18 at 6:34













Follow this answer for your result: stackoverflow.com/a/53455884/1673192

– iDev750
Nov 24 '18 at 6:53





Follow this answer for your result: stackoverflow.com/a/53455884/1673192

– iDev750
Nov 24 '18 at 6:53













stackoverflow.com/a/32302797/2303865

– Leo Dabus
Nov 24 '18 at 10:34





stackoverflow.com/a/32302797/2303865

– Leo Dabus
Nov 24 '18 at 10:34













stackoverflow.com/a/27337951/2303865

– Leo Dabus
Nov 24 '18 at 10:36





stackoverflow.com/a/27337951/2303865

– Leo Dabus
Nov 24 '18 at 10:36












0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Futebolista

Feedback on college project

Albești (Vaslui)