Can anyone provide a script file that will allow me to set the current date as a session variable in the format "MM/DD/YYYY"
I need to pass the current date to run a report and then get the data.
Thanks TS
import java.text.SimpleDateFormat; import java.util.Date;
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); session.log(formatter.format(new Date()));
Shadders --- thanks the current date format works great.
Can you assist with what to add to this code to get yesterday's date??
Thanks again for your help!
TS
Hi tommie,
this is how I'd do it... it seems like an awful lot of messing around just to get yesterday's date so if anyone know's a quicker way to do this please let me know.
import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar;
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
Calendar cYesterday = Calendar.getInstance(); cYesterday.add(Calendar.DATE, -1); Date dYesterday = cYesterday.getTime();
session.log(formatter.format(dYesterday));
import
import java.text.SimpleDateFormat;
import java.util.Date;
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
session.log(formatter.format(new Date()));
Yesterday's Date?
Shadders --- thanks the current date format works great.
Can you assist with what to add to this code to get yesterday's date??
Thanks again for your help!
TS
Hi tommie, this is how I'd do
Hi tommie,
this is how I'd do it... it seems like an awful lot of messing around just to get yesterday's date so if anyone know's a quicker way to do this please let me know.
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
Calendar cYesterday = Calendar.getInstance();
cYesterday.add(Calendar.DATE, -1);
Date dYesterday = cYesterday.getTime();
session.log(formatter.format(dYesterday));