Date function for yesterday and tomorrow

482 views
Skip to first unread message

Pilli, Kishore

unread,
Oct 25, 2013, 10:29:23 AM10/25/13
to suppor...@runmyprocess.com
Hi,

I am fetching email data from collection based on due_date and sending mail. So I have written freemarker code for the same. But I want to compare due_date with yesterday or tomorrow. 

Please find the below code and let me know date function for tomorrow and yesterday.

<#assign mgrEmailArray = []>
<#assign mypattern>
{"due_date": "${now()}"}
</#assign>
<#assign mgrEmailArray = inject_objects(list_objects(mypattern,"due"),"email")>

<#assign mgrEmail = "">
<#list mgrEmailArray as x>
<#assign mgrEmail = mgrEmail +" "+ x.email>
</#list>
${mgrEmail}

Thank you!
Kishore

Richard Manga

unread,
Oct 25, 2013, 12:29:42 PM10/25/13
to suppor...@runmyprocess.com
Hi Pilli,

It's possible to get yesterday and tomorrow date in JS. You will use the function "getDate()".

For example, if you create the variable days: var days = new Date();
days.setDate(d.getDate() - 1); // this will give you yesterday date.
Best regards,

Richard Manga


2013/10/25 Pilli, Kishore <Kishor...@arrisi.com>

--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/2152A91F4CF0974BAC2D3D52343E774B24F58F94%40ATLEXMBX2.ARRS.ARRISI.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/groups/opt_out.

kishor...@gmail.com

unread,
Oct 25, 2013, 1:30:28 PM10/25/13
to suppor...@runmyprocess.com
Hi Richard,

Thank you for giving reply.

Could you please provide same in freemarker.

Regards,
Kishore

On Friday, October 25, 2013 9:59:42 PM UTC+5:30, Richard Manga wrote:
> Hi Pilli,
>
>
> It's possible to get yesterday and tomorrow date in JS. You will use the function "getDate()".
>
>
>
> For example, if you create the variable days: var days = new Date();
> days.setDate(d.getDate() - 1); // this will give you yesterday date.
> Best regards,Richard Manga

madhuri.ru...@gmail.com

unread,
Oct 29, 2013, 7:33:24 AM10/29/13
to suppor...@runmyprocess.com, kishor...@gmail.com
Hi Kishore,
you can use javascript in process.
Please go through the link
https://sites.google.com/a/runmyprocess.com/user-guide-runmyprocess/3---developer-guide/processes/how-to-design/use-javascript-in-the-process

here is code which you can put and assign it to a variable in process.

<@script env="javascript">
function get_date()
{
var x=new Date();

var yesterday=x.getDate()-1;
return yesterday;
}
var tmp1 = get_date();
print(tmp1);/for testing purpose in test console
</@script>

Thanks & regards,
Madhuri,Fujitsu

Richard Manga

unread,
Oct 29, 2013, 11:01:00 AM10/29/13
to suppor...@runmyprocess.com
Hi Kishore.

The following code will help you to find tomorrow and yesterday date in free marker:

date_offset(date,number of days,target_format): this function returns a date with an offset of a day.

So, if you want tomorrow date, you will write the following code: tomorrow=date_offset(now(),1) ;

If you want yesterday date, you will write the following: yesterday=date_offset(now(),-1) ; 


Best regards,

Richard Manga.


2013/10/25 <kishor...@gmail.com>
Reply all
Reply to author
Forward
0 new messages