datetime ,date created

web dev asked on May 7, 2018 19:35

hello freinds any one have idea i try to apply a macro to show new created jobs my macro:

{% if((DateTime.Now - DateCreated) < 7){ %}

NEW {% } #%}

but its not working thanks

Correct Answer

Peter Mogilnitski answered on May 7, 2018 22:51

Not quite sure about your question, assuming you want to get difference in days: macro should be something like this:

{%(DateTime.Now - DateTime.Now.AddDays(5)).TotalDays #%} gives -5

I guess in your case:

{% if((DateTime.Now - DateCreated).TotalDays < 7) ...%}

0 votesVote for this answer Unmark Correct answer

Recent Answers

web dev answered on May 8, 2018 10:33

thanks peter for help

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.