I am using php code for CreateRecurringPaymentsProfile method with following NVP Request:-
VERSION=86
METHOD=CreateRecurringPaymentsProfile
TOKEN=ABCX123V
PROFILESTARTDATE=2014-09-17T04:58:00Z
DESC=Test Payment
BILLINGPERIOD=Week
BILLINGFREQUENCY=6
AMT=1
CURRENCYCODE=USD
IPADDRESS=127.0.0.1
My billing period = Week, billing frequency = 6; and profile starts on 17 Sep.,2014; then after 6 week on 29th Oct., 2014 recurring should work. When I check the transaction with TransactionSearch method with following NVP Request:-
VERSION=86
METHOD=TransactionSearch
STARTDATE=2014-09-01T03:38:48Z
PROFILEID=I-AB2FGH38BDA3
NVP Response:-
[L_TIMESTAMP0] => 2014-09-17T05:04:55Z
[L_TIMESTAMP1] => 2014-09-18T03:23:50Z
[L_TIMESTAMP2] => 2014-10-30T14:09:36Z
[L_TIMEZONE0] => GMT
[L_TIMEZONE1] => GMT
[L_TIMEZONE2] => GMT
[L_TYPE0] => Recurring Payment
[L_TYPE1] => Recurring Payment
[L_TYPE2] => Recurring Payment
[L_EMAIL1] => test#domain.com
[L_EMAIL2] => test#domain.com
[L_NAME0] => Test Buyer
[L_NAME1] => Test Buyer
[L_NAME2] => Test Buyer
[L_TRANSACTIONID0] => I-NAR3FUC7SAHA
[L_TRANSACTIONID1] => 7AZ3079982647961N
[L_TRANSACTIONID2] => 5MP14432TD321593W
[L_STATUS0] => Created
[L_STATUS1] => Completed
[L_STATUS2] => Completed
[L_AMT1] => 1.00
[L_AMT2] => 1.00
[L_CURRENCYCODE1] => USD
[L_CURRENCYCODE2] => USD
[L_FEEAMT1] => -0.33
[L_FEEAMT2] => -0.33
[L_NETAMT1] => 0.67
[L_NETAMT2] => 0.67
[TIMESTAMP] => 2014-10-31T12:13:44Z
[CORRELATIONID] => b20bec6476812
[ACK] => Success
[VERSION] => 86
[BUILD] => 13443904
Transaction starts on 17 Sept, 2014 and then why paypal do transaction on 18 Sept, 2014 and calculate 6 weeks from 18th Sept, 2014 and so last transaction is on 30 Oct, 2014
And next payment due date is on 10 Dec, 2014
Please guide me.
Regards
From the documentation on CreateRecurringPaymentsProfile
Note The profile may take up to 24 hours for activation.
If you need a payment right now, what you can do is use INITAMT and then set your start date for 6 weeks.
Related
and date(p.date_of_sale) <= current_date
I try this code and I got an answer like that.
.
But an error is shown like that.
.
Please watch 2 screenshots because I am not fluent in English and I don't know how to explain with text. That's why I add 2 screenshots.
Your problem comes from to_char(p.date_of_sale, 'yyyy "-week" iw') where
iw = week number of ISO 8601 week-numbering year (01–53; the first Thursday of the year is in week 1)
whereas yyyy = the year on 4 digits (not the ISO8601 year)
These two parameters are sometimes not consistent for instance for 2023 January the 1st :
SELECT to_char('20230101' :: date, 'yyyy') => 2023
SELECT to_char('20230101' :: date, 'iw') => 52
If you want to be consistent, you can either :
select to_char('20230101' :: date, 'YYYY"-week" w') => 2023-week 1
or
select to_char('20230101' :: date, 'IYYY"-week" iw') => 2022-week 52 (ISO8601 year and week)
see dbfiddle
os.date("!*t") in lua return a table like this:
year a full year
month 01-12
day 01-31
hour 00-23
min 00-59
sec 00-59
isdst a boolean, true if daylight saving
But we have some variable that not present in this table like timezone, start week etc...
We can get them by os.date(%z %p), but is there any way to get a more complete version of the above table with os.date or any other internal library?
I want just run one time os.date() inside my code, and avoid running that for second time to get os.date(%z %p)
is there any way to get a complete table of all available tags?
Base of lua document avilabel tag is
%a abbreviated weekday name (e.g., Wed)
%A full weekday name (e.g., Wednesday)
%b abbreviated month name (e.g., Sep)
%B full month name (e.g., September)
%c date and time (e.g., 09/16/98 23:48:10)
%d day of the month (16) [01-31]
%H hour, using a 24-hour clock (23) [00-23]
%I hour, using a 12-hour clock (11) [01-12]
%M minute (48) [00-59]
%m month (09) [01-12]
%p either "am" or "pm" (pm)
%S second (10) [00-61]
%w weekday (3) [0-6 = Sunday-Saturday]
%x date (e.g., 09/16/98)
%X time (e.g., 23:48:10)
%Y full year (1998)
%y two-digit year (98) [00-99]
%% the character `%´
From Lua 5.4 Reference Manual: os.date:
If format starts with '!', then the date is formatted in Coordinated
Universal Time. After this optional character, if format is the string
"*t", then date returns a table with the following fields: year, month
(1–12), day (1–31), hour (0–23), min (0–59), sec (0–61, due to leap
seconds), wday (weekday, 1–7, Sunday is 1), yday (day of the year,
1–366), and isdst (daylight saving flag, a boolean). This last field
may be absent if the information is not available.
If you want the table to contain more fields, you need to implement this yourself.
Lua is ANSI C compatible.
That means Lua does not provide access to extra struct tm fields from glibc in it's standard lib (see https://man7.org/linux/man-pages/man3/ctime.3.html#NOTES)
If you want to utilize these extra struct tm glibc fields:
long tm_gmtoff; /* Seconds east of UTC */
const char *tm_zone; /* Timezone abbreviation */
Then, as #Piglet already mentioned, You'll need to implement it yourself.
You can either patch an original Lua source here:
https://github.com/lua/lua/blob/master/loslib.c#L230
(which is a bad decision in general), or you can write your own glibc-dependent lua c module, which is way better.
As mentioned before 'If you want the table to contain more fields, you need to implement this yourself.'
And i love Lua for that.
Its so easy...
> dtable = setmetatable(os.date('!*t'), {__call = function(self) self.tz=os.date('%z') self.ampam = os.date('%p') return self end})
> dir = function(tab) for k, v in pairs(tab) do print(k, '=>', v) end end
> dir(dtable)
wday => 6
yday => 294
hour => 19
isdst => false
day => 21
sec => 22
month => 10
min => 3
year => 2022
> dir(dtable())
wday => 6
ampam => PM
tz => +0200
yday => 294
hour => 19
isdst => false
day => 21
sec => 22
month => 10
min => 3
year => 2022
So after above check/control a simple...
dtable = setmetatable(os.date('!*t'), {__call = function(self) self.tz=os.date('%z') self.ampam = os.date('%p') return self end})
dtable = dtable()
...extend the table.
Tip: Ever tried os.setlocale()?
> os.setlocale('de_DE.utf8','time')
de_DE.utf8
> dir(dtable())
wday => 6
ampam =>
tz => +0200
yday => 294
hour => 19
isdst => false
day => 21
sec => 22
month => 10
min => 3
year => 2022
> os.setlocale('ja_JP.utf8','time')
ja_JP.utf8
> dir(dtable())
wday => 6
ampam => 午後
tz => +0200
yday => 294
hour => 19
isdst => false
day => 21
sec => 22
month => 10
min => 3
year => 2022
...it is worth as argument for the __call metamethod...
__call = function(self, locale)
local locale = locale or 'en_US.utf8'
os.setlocale(locale, 'time')
self.tz = os.date('%z')
self.ampam = os.date('%p')
return self
end
And with a more extended dtable.lua and dir.lua you can do like...
dir(dtable('de_DE.utf8'))
1 z (string) => +0200 (string) 5 byte
2 B (string) => Oktober (string) 7 byte
3 b (string) => Okt (string) 3 byte
4 hour (string) => 20 (number) integer
5 A (string) => Freitag (string) 7 byte
6 month (string) => 10 (number) integer
7 isdst (string) => false (boolean)
8 min (string) => 29 (number) integer
9 p (string) => (string) 0 byte
10 sec (string) => 52 (number) integer
11 a (string) => Fr (string) 2 byte
12 day (string) => 21 (number) integer
13 year (string) => 2022 (number) integer
14 yday (string) => 294 (number) integer
15 wday (string) => 6 (number) integer
> dir(dtable('ja_JP.utf8'))
1 z (string) => +0200 (string) 5 byte
2 B (string) => 10月 (string) 5 byte
3 b (string) => 10月 (string) 5 byte
4 hour (string) => 20 (number) integer
5 A (string) => 金曜日 (string) 9 byte
6 month (string) => 10 (number) integer
7 isdst (string) => false (boolean)
8 min (string) => 29 (number) integer
9 p (string) => 午後 (string) 6 byte
10 sec (string) => 52 (number) integer
11 a (string) => 金 (string) 3 byte
12 day (string) => 21 (number) integer
13 year (string) => 2022 (number) integer
14 yday (string) => 294 (number) integer
15 wday (string) => 6 (number) integer
i am using the following code
DateFormat.yMMMMEEEEd("en_US").format((myDateTime)
that give me the following output (Date of writing my question)
Tuesday June 21 , 2022
well , now i don't want the previous format look like the previous output UNLESS if there is one week back as a maximum Period
for example i am looking for Format to Auto describe days of the week by (names) like following.
Assuming today is Tuesday
output => 'now' (if 5 mins as maximum ) else output => 'Today'
else:
output => 'yesterday' (if there one day back )
output => 'Sunday'
output => 'Saturday'
output => 'Friday'
output => 'Thursday'
output => 'Wednesday'
NOW finally we arrive to same day whish is Tuesday that means 1 week passed so i need output like my first format in my question
output => 'Tuesday June 21 , 2022'
And so
output => 'Tuesday June 21 , 2022'
output => 'Monday June 20 , 2022'
output => 'Sunday June 19 , 2022' ...... and so
in other words i only care of showing a week back in
their names only : now(if 5 mins as maximum) till A week back in
their names else DateFormat.yMMMMEEEEd("en_US").format((myDateTime)
what is the easiest and best way to do it . thanks
I am new to Perl and I am trying to figure out how to get the start and end date of the previous quarter. For example:
Jan 2nd, 2020 - The output should be 20191001, 20191231
July 27th, 2020 - The output should be 20200401, 20200630
Thanks in advance for all the help and guidance.
use DateTime qw( );
my $prev_quarter_start =
DateTime
->now( time_zone => 'local' )
->set_time_zone('floating') # Use this when dealing with dates.
->truncate( to => 'quarter' )
->subtract( months => 3 );
my $prev_quarter_end =
$prev_quarter_start
->clone
->add( months => 3 )
->subtract( days => 1 );
say $prev_quarter_start ->ymd('');
say $prev_quarter_end->ymd('');
Requires DateTime 1.32.
I'm trying to use the is_dst() method in the DateTime module to determine whether a daylight savings transition is occurring.
I started by writing a very basic example that I was sure would work, but for some reason I'm getting unexpected results.
Example:
#!/usr/bin/perl
use strict;
use warnings;
use DateTime;
my $dt1 = DateTime->new(
'year' => 2015,
'month' => 3 ,
'day' => 8 ,
'hour' => 3 ,
);
my $dt2 = DateTime->new(
'year' => 2015,
'month' => 3 ,
'day' => 7 ,
'hour' => 3 ,
);
print $dt1."\n";
print $dt2."\n";
print $dt1->is_dst()."\n";
print $dt2->is_dst()."\n";
I started with a date that I knew was a daylight savings transition: Sunday, March 8, 2015. I chose 3 AM because I knew that the daylight savings transition would have already occured at that point in time.
Then I took a date that I knew was before the daylight savings transition: Saturday, March 7, 2015 also at 3 AM.
Then I print the two dates and their corresponding DST flags.
Output:
2015-03-08T03:00:00
2015-03-07T03:00:00
0
0
The two dates print exactly as expected, but for some reason even though the first date occurs during daylight savings time, and the second date occurs before daylight savings time, the DST flag is not set for both of them.
Why is this not working correctly? Am I missing something?
You have to explicitly set the time zone:
The default time zone for new DateTime objects, except where stated otherwise, is the "floating" time zone...A floating datetime is one which is not anchored to any particular time zone.
For example:
use strict;
use warnings;
use DateTime;
my $dt1 = DateTime->new(
'year' => 2015,
'month' => 3,
'day' => 8,
'hour' => 3,
'time_zone' => 'America/New_York'
);
my $dt2 = DateTime->new(
'year' => 2015,
'month' => 3,
'day' => 7,
'hour' => 3,
'time_zone' => 'America/New_York'
);
print $dt1."\n";
print $dt2."\n";
print $dt1->is_dst()."\n";
print $dt2->is_dst()."\n";
Output:
2015-03-08T03:00:00
2015-03-07T03:00:00
1
0