How to get yesterday's date in a Formula tool
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello all,
I am trying to create a workflow that will send an attachment by email every day. The filename changes reflecting yesterdays date in the filename. So the report send today would have this file name: Report_2015_12_22.csv (also note the underscores being used in the date)
I am using a Text Input tool to get the name of the attachment and then using a Formula tool to replace the date part in the attachment field. If the file name was using today's I would have already fixed it using this formula: 'C:\Apps\' + 'Report_' + Replace(DateTimeToday(),"-","_") + '.csv'
The output is C:\Apps\Report_2015_12_23.csv.
However to get yesterday's date in and replace the hyphens with underscores I am stuck and cannot get it to work.
I've attached a sample workflow and report.
Does anyone know how to accomplish this?
Thanks in advance!
Roel
edit: changed extension used
Solved! Go to Solution.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Colleague helped me out already:
'C:\Apps\' + 'Report_' + DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,"days"), "%Y_%m_%d") + '.csv'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This is so helpful when I tried to figure out why number age group changes comparing with yesterday's number.
Thank you so much!!
@RoelEsselink wrote:Colleague helped me out already:
'C:\Apps\' + 'Report_' + DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,"days"), "%Y_%m_%d") + '.csv'
