Powershell Get-date minus one day...
Here is the delima, I need to get yesterdays day in the format of yymmdd. That's easy if you want todays date:
get-date -uformat %y%m%d
Great! Now how do I get yesterdays date?
(get-date).AddDays(-1)
will get me
Wednesday, June 22, 2011 8:47:51 AM
But, I cant do
(get-date).AddDays(-1) -uFormat %y%m%d
Nor can I do
(get-date -uFormat %y%m%d).AddDays(-1)
Nor is there a .Net date/time format of yymmdd. Any suggestions would be appreciated. Thank you!
So if i wanted to get the current date to a format of YYYY.MM.DD, I can get it by
(get-date).ToString("YYYYMMDD") ?? Since i have file names that contain the below i need only to get those with a certain current date embedded.
Update_YYYYMMDDHHMMSSMS.log or Update_2014021802113801.log
Similar Messages
-
IDOCS get created After one day?
Hello all,
the outbound idocs are get created after one day delay,
After uploading the materials the idocs have to generated through program RBDMIDOC and need to be posted immediately .
RBDMIDOC-scheduled at 10 mints .
but in our scenario the idocs are generated after one day delay..
what could be the reason?.
it's urgent .
Warm regards
Nandan
Edited by: Nandan ND on Feb 19, 2008 12:47 PM
Edited by: Nandan ND on Feb 19, 2008 1:35 PM
Edited by: Nandan ND on Feb 19, 2008 1:36 PMHi,
Check whether program RBDMIDOC is scheduled only once? If it is running only once then you this will happen.
And also schedule the job to execute only after your upload process is over.
Regards,
Ashok -
Converting date value one day less while transfering from client to server
Hi,
I have very typical problem. My application is in java, we are using oralce 9ias. The problem when the server is running in german locale and client is running in english. We the date value is passed from client to server it is converting to one day less.
i.e.
If i want to search with records jan 02,2005,
on server side if we print the value it is getting as jan 01,2005.
Can anybody help me in solving the above problem.
Its bit very urgent.
Thanks in advance
regards
Kalyan// to get current time in Germany
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("Germany"));
int hour12 = cal.get(Calendar.HOUR);
int minutes = cal.get(Calendar.MINUTE);
int seconds = cal.get(Calendar.SECOND);
boolean am = cal.get(Calendar.AM_PM) == Calendar.AM;
//I think all you need to do is to set the timezone to the current, so that when the
//server at some other timezone gets this date it knows that this date belongs to
//different timezone and gets converted automatically according to the server
//timezone settings.
// Set the current local timezone
cal.setTimeZone(TimeZone.getDefault());
int hour24 = cal.get(Calendar.HOUR);
Hope this answers your question. Good luck.
-Sreekanth varidhireddy -
BPM Java WebDynpro xsd:date decrease one day
Hi Experts.
I have a problem with the context between Java WebDynpro and BPM. I have an attribute of date type , when BPM call the Web Dynpro UI, this date it shows to user with one day minus, but in BPM Context and Web Dynpro context are with the correct date.
I checked the BPM context and the value of this attribute is: "2011-08-06Z".
I think that the problem is with the "Z" because it's like a time zone.
Any suggestions?
Thanks,
Julian.Hello Julian,
We faced the same issue as you, and after doing all checks in configuration, nothing!, finally we found a SAP note that recommends to change the date type to string types, but, we have a lot of webservices calls and mappings that requieres a "date" type and this make more dificult the "solution".
Then we found a little tricky solution.
We change the webdynpro Date types to Strings, and make the transformation in bpm mapping to cast as xsd:date, finally in webdynpro you must perform a string.format for the outgoing date as BPM is specting the date ( "YYYY-MM-DD")
With this solution you see a "date" type in BPM context and String type in Webdynpro and the offtset disappears.
This solution maybe is similar to SAP Note, but you don't need to change all your consumed webservices types.
Regards!
Julio Cesar Leyva -
WinPE powershell get-date incorrect
Greetings,
We are running the latest MDT, WinPE and CM2012 CU2.
I wanted to track the time it takes to build an OS.
I have a powershell script that does a simple get-date during the WinPE phase and a powershell script that does a get-date at the end of the OSD. The one at the end is fine. The get-date in WinPE is returning a time 18 hours ahead of the current time.
We are GMT+10 and the computer BIOS that we are deploying to has the correct date/time. Is this some weird WinPE powershell default that all datetimes are 18 hours ahead of the real datetime?
Cheers
David ZIt's because the time zone in WinPe is Pacific Standard Time.
You can change the time zone in winpe, here is a guide:
http://adminnexus.blogspot.se/search?q=winpe -
BBM on BB Classic eating up a lot of mobile data during one day and without reason
Hello, on August 1, BBM (10.9.5.22) on my Classic (software release 10.3.1.1779) suddenly consumed about 125 megabytes of data via mobile network within one day, without having used BBM for anything but a few text messages and with only one chat having been active. Maybe there were about two photos, but only in the default low resolution which are never above a few hundred kilobytes. Is anyone able to explain this behaviour? I'm a little bit frustrated as 125 megabytes are a lot if the free "high speed" volume per month is only several 100 megabytes, and BBM consumes a lot of it right of the beginning of a month And otherwise, e.g. for video calling, it asks if you really want to do that on a mobile network... Thanks for any idea and best regards, Hans-Juergen
The frustration continues... now BBM consumes at least (!) 40 megabytes per day, by only using it for a fwe text messages. However, I found an interesting knowledge base article saying that "BBM" within the device monitor might be related to other tasks using an "EBMService". http://btsc.webapps.blackberry.com/btsc/KB36954 Here are the most recent mobile data usage graphs - totals first: Then BBM details: As a comparison, the previous month. On July 18th I started using BBM, and it seems it already started eating mobile data there right away: Before I started using BBM, 500 megabytes per month were more than enough. Now it seems as if BBM alone will berak my current 1 GB limit far before the end of this month! By searching the forum, I found multiple similar issues, but none of them solved completely. Except for the parental control attempt, but as I want to use BBM, that is not appropriate for me. http://supportforums.blackberry.com/t5/BBM-for-BlackBerry/BBM-high-data-wi-fi-usage/m-p/3110624 http://supportforums.blackberry.com/t5/BBM-for-BlackBerry/Extreme-BBM-Data-usage-this-past-month/m-p/3104776 http://supportforums.blackberry.com/t5/BBM-for-BlackBerry/BBM-Data-usage-extremely-high/m-p/3098544 http://supportforums.blackberry.com/t5/BBM-for-BlackBerry/BBM-extreme-data-usage/m-p/3079395
-
Powershell get-date 1st and 3rd Wednesday
I'm trying to run a script every the 1st and 3rd Wednesday of each month.
Any ideals?
Thanks,
KevinThat means it's not working on a monthly basis. Assuming you don't want it to store a 'last run' somewhere you'd probably have to adjust it to loop through the entire year.
$AllWednesdays = (0..365 | foreach {
([datetime](Get-Date).ToString('01/01/yyyy')).AddDays($_) |
Where {$_.dayofweek -eq 'Wednesday'} } )
$evenWednesdays = @()
for ($counter = 0; $counter -lt $allWednesdays.count; $counter++)
if ($counter % 2 -eq 0)
$evenWednesdays += $AllWednesdays[$counter]
I'm sure there's a much nicer way to do it though. -
Date minus (-) one month via formular
Hello,
I look for a BW formula to calculate a date - one month. At the moment I use the following formula but I'm not happy with this solution.
IF( DATE_MONTH( CALDAY ) = DATE_MONTH( ADD_TO_DATE( LOAD_DATE, NEGATIVE( 15 ) ) ), WS_COUNT, 0 )
Regards, ThomasHere's a go at it using a routine. Not sure if the c's need to be i's for the calculations, so you may need to play around with it. Also this code doesn't check for validity of the 29th, 30th, 31st dates (March 31 going back to Feb 31 is invalid).
DATA: l_m1(2) type c,
l_m2(2) type c,
l_y(4) type c,
l_d(2) type c,
l_lastmonth like <date_field>.
l_y = <date_field>+0(4). "first 4 characters = year
l_m1 = <date_field>+4(2). "5-6 = month
l_d = <date_field>+6(2). "7-8 = day
l_m2 = l_m1 - 1. " get last month
IF l_m1 = 0. "check for january
l_m1 = 12.
l_y = l_y - 1.
ENDIF.
CONCATENATE l_y l_m1 l_d into l_lastmonth. "rebuild date
RESULT = l_lastmonth.
It's a start and a direction, so take it as such and not as the correct solution because I don't really know your requirements or exactly what you are trying to do.
Brian -
Select statement problem. how to get data in one row
SELECT
razm.datum_sklenitve,
razm.datum_prenehanja,
FROM
zket_zaposlenci zap,
zket_delovna_razmerja razm,
zket_delovne_razporeditve razp,
zket_sistemizacije_dm sistdm,
zket_organizacijske_enote oe,
zket_delovna_mesta delm
WHERE
zap.iid_zaposlenca = razm.iid_zaposlenca and
razm.iid_delovno_razmerje = razp.iid_delovno_razmerje and
sistdm.iid_sistemizacija_dm(+) = razp.iid_sistemizacija_dm and
nvl(sistdm.iid_organizacijske_enote, razp.iid_organizacijske_enote) = oe.iid_organizacijske_enote and
sistdm.iid_delovno_mesto = delm.iid_delovno_mesto and
razm.datum_sklenitve <= to_date('31.12.'||:v_datum, 'dd.mm.yyyy') and
nvl(razm.datum_prenehanja, to_date('31.12.'||:v_datum, 'dd.mm.yyyy')) >= to_date('01.01.'||:v_datum, 'dd.mm.yyyy') and
razp.datum_nastopa_dela <= to_date('31.12.'||:v_datum, 'dd.mm.yyyy') and
nvl(razp.datum_prenehanja_dela, to_date('31.12.'||:v_datum, 'dd.mm.yyyy')) >= to_date('01.01.'||:v_datum, 'dd.mm.yyyy') and
zkep_splosno.zkep_hierarh_oe_n(nvl(sistdm.iid_organizacijske_enote, razp.iid_organizacijske_enote), :v_oe, to_date('31.12.'||:v_datum, 'dd.mm.yyyy')) = 1 and
to_char(zkep_splosno.zkep_vrni_prvi_dr(razm.iid_delovno_razmerje, to_date('31.12.'||:v_datum, 'dd.mm.yyyy')), 'yyyy') = :v_datum
and zap.iid_zaposlenca = 1093507
order by razm.datum_sklenitve DESC
return this rows:
datum_sklenitve datum_prenehanja
1: 01.10.2010 00:00:00 | 31.12.2010 00:00:00
2: 01.10.2010 00:00:00 | 31.12.2010 00:00:00
3: 01.04.2010 00:00:00 | 31.08.2010 00:00:00
4: 01.02.2010 00:00:00 | 31.02.2010 00:00:00
how can i get in one select just this result.
1: : 01.10.2010 00:00:00 | 31.08.2010 00:00:00 (first of A and then the next one of B which is not the same as top of B)
I try everything but i do not know how. If anyone know how to do this.
regards,
MBSimma wrote:
But the above is not documented.Not only that, but it's string aggregation which isn't meeting the OP's requirements.
Though you could be easily forgiven as the OP hasn't clearly stated the logic behind the requirements.
It could be something like wrapping the original SQL with something like the following...
SQL> ed
Wrote file afiedt.buf
1 with t as (select date '2010-10-01' as ds, date '2010-12-31' as dp from dual union all
2 select date '2010-10-01', date '2010-12-31' from dual union all
3 select date '2010-04-01', date '2010-08-31' from dual union all
4 select date '2010-02-01', date '2010-02-28' from dual)
5 --
6 -- END OF TEST DATA
7 --
8 select max(case when rn = 1 then ds else null end) as ds
9 ,max(case when rn = 2 then dp else null end) as dp
10 from (
11 select ds, dp, row_number() over (order by ds desc nulls last) rn
12 from (
13 select case when lag(ds) over (order by ds desc) = ds and lag(dp) over (order by ds desc) = dp then null else ds end as ds
14 ,case when lag(ds) over (order by ds desc) = ds and lag(dp) over (order by ds desc) = dp then null else dp end as dp
15 from t
16 order by t.ds
17 )
18* )
SQL> /
DS DP
01/10/2010 00:00:00 31/08/2010 00:00:00
SQL>but who knows? -
How can we get data from One Form to Another Form
Hi All,
I have 2Forms.I'm calling one form from another form buy using next form button.
If i press itis opening 2nd form,Simultaneously i have to get the data to the 2nd form.Can any one help me in this.
Any triggers has to be fire tell me the solution
Regards
Sivayou may have better success over here
Forms -
Get date of first day of current week
HI!
Why does the following method do not return the date of the first day of the week in which the given date lies?
public static int getFirstDayOfWeek(int year, int month, int date) {
GregorianCalendar GregCalendar = (GregorianCalendar)
new GregorianCalendar(year, month, date).getInstance();
while(GregCalendar.get(Calendar.DAY_OF_WEEK)!= Calendar.MONDAY) {
GregCalendar.roll(Calendar.DATE, false);
return GregCalendar.get(Calendar.DATE);
What I want the method to do:
year = 2003
month = Calendar.JANUARY
date = 8
==> GregCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY
==> GregCalendar.roll(Calendar.DATE, false);
==> GregCalendar.get(Calendar.DATE) == 7 (?????????)
==> GregCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.TUESDAY
==> GregCalendar.roll(Calendar.DATE, false);
==> GregCalendar.get(Calendar.DATE) == 6
==> GregCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY
==> return GregCalendar.get(Calendar.DATE)
But in reality, it always returns 6 grrrrrrrr
What is wrong wirh it?
Yours RBpublic Date getCurrentMonday()
Date monday = null;
Calendar rightNow = Calendar.getInstance();
int day = rightNow.get(Calendar.DAY_OF_WEEK);
int distance = 0;
if (day == Calendar.MONDAY)
monday = rightNow.getTime();
else
distance = day - Calendar.MONDAY;
if (distance == -1)
distance = 6;
monday = (Date) (rightNow.getTime());
monday.setTime(monday.getTime() - 1000 * 60 * 60 * 24 * (distance));
return monday;
} -
Good morning,
I'm trying to get a string value the contaings the current day minus 3 months.
thanksHi,
Thank you for your help, with you suggestions I was able to
find what I need it
thanks -
How to get data from one ui element?
hi all
I have a DropDownByIndex and I know how I can get the value selected
thanksHI,
suppose the dropdownbyindex is bind with the attribute "testName" in the node "Test".
so the context is like
Test
.....testName
so to get the selected value do like this
wdContext.nodeTest().getTestElementAt(wdContext.nodeTest().getLeadSelection()).gettestName();
hope it clear!
Regards,
ramesh -
How to set SPD workflow to send email one day before the Due Date? ?
I need to add a step in workflow for a item tracking list: send reminder email one day before the due date.
I thought there is an Action in SPD: wait for [Due Date] to equal [Today]minus one day
But there is no way to do that.
I figured may be I need to create a calculated field [cal-date] that set to: =[today] plus one day.
Then in workflow -
wait till [Due Date] is equal to [cal-date], and send an email
What is the formula for the above calculated field [Today] plus one day?Hi,
You can add an approval action( such as Start Approval Process) -> click "Approval" -> go to “Change the behavior of a single task” . Then you will
see the "When Task expires" stage.
You can have a look at the blog:
https://www.nothingbutsharepoint.com/sites/eusp/Pages/5-Steps-to-Enhance-SharePoint-2010-Approval-Workflow.aspx
Thanks,
Eric
Forum Support
Please remember to mark the replies as answers
if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]
Eric Tao
TechNet Community Support -
PreparedStatement set date sometimes sets the date one day behind
I have a PreparedStatement that sometimes sets the date a day behind. I am saving to a MSSQL DB with a field datetime. I have two identical PreparedStatments, one for insert and one for update. When either is executed, it will sometimes set the date back one day. It's not everytime. Every other or every third one, but it's not consistent. Any help would be appreciated.
ps.setDate(1, Util.parseSqlDate(getParam("CHARGED")));
public class Util {
public static java.sql.Date parseSqlDate(String datestr) {
DateFormat sdf = null;
if (datestr == null)
return null;
if (datestr.length() > 8) {
sdf = new SimpleDateFormat("MM/dd/yyyy");
else {
sdf = new SimpleDateFormat("MM/dd/yy");
java.util.Date d = null;
try {
d = sdf.parse(datestr);
} catch (ParseException e) {
return null;
if (d != null) {
Calendar cal = Calendar.getInstance();
cal.setTime(d);
return new java.sql.Date(cal.getTimeInMillis());
return null;
protected String getParam(String name) {
return (getParamArray(name)== null) ? null : getParamArray(name)[0];
protected String[] getParamArray(String name) {
return (String[])params.get(name);
}traigo wrote:
The database is a datetime field. Then you should be using the appropriate java jdbc time/date methods to access it rather than strings.
We are only storing the date portion. Saving with today's date should produce '2009-12-28 00:00:00.000'.
I just want to set the date to an absolute date (no time value) provided without timezones.Impossible. Since the database datatype is datetime that means that a timezone is always involved.
And java always uses timezones. Ignoring the problem doesn't make it go away.
Maybe you are looking for
-
I have a windows CS3. Does anyone want to trade a Mac CS3 for it?
-
I just noticed my itunes app store isnt on my itunes
on my pc itunes will open. the music, movies,tv shows will open but the app store is just a white page . no apps to view
-
More than 100 members in Dynamic Calc
Hi, I just realised I had more than 100 children for a dynamic calc member in a sparse dimension. I can save outline but its sends me warnings. What else could happen if I leave it as it is?Thanks in advance
-
DefaultWebApp - depricated in WebLogic 9.1.what to do?
hi. i have noticed that the attribute 'DefaultWebApp' of MBean 'WebServer' is deprecated, and is NULL. so how can i know now what is the web server's default application? -Ohad
-
Slow Admin Api with CF8 and 100ish sandboxes
Hi I am trying to automate the creation of sandboxes for my cluster and have a set of scripts that use the admin api. The thing is that it is really slow, taking over 5 seconds to return function calls. With 2Gb of ram and 64 cores available to the j