Show the current year in an email through AMPscript - ampscript

I've been trying to dynamically change the year of the copyright in an e-mail template in Salesforce Marketing Cloud.
I've tried code snippets from the internet but none of it is working.
%%=Format(Now(), "MMMM d, yyyy")=%%
%%Now()%%
and even non AMPscript:
YEAR(TODAY())
But when I receive the email this is the result: https://imgur.com/a/vfMk5jy

I believe you're looking for the xtyear personalization string.
You'd use it like this:
© %%xtyear%% sprignaturemoves.com

If your email template is built using AMPscript you can use the following:
%%[
/* AMPscript */
SET #CurrentYear = Format(Now(), "yyyy")
]%%
/* The Variable in the email body */
%%= v(#CurrentYear) =%%
Now() displays the current system date and time (1/1/2020 10:00:00). Adding the formatting reduces the value down to just the year.

Related

QlikView set analysis with date: nothing result

I have a problem with a set analysis in QlikView with the date.
I have created a table that contains the sales order.
One field contains the dates of requesting products.
Now if I use a set analysis to filter the data, I receive 0.
The code used that is not working is below.
If I use a set analysis with one date (see below) I receive the orders that have that date in Ord.Original.Req.Date.
Any suggestion?
code not working:
sum({$< Ord.Campain={$(=(max(Ord.Campain)-1))},
Ord.Original.Req.Date = {"$(='<=' & Date(monthend($(vMaxDateAP)), 'DD/MM/YYYY')"}>}
Ord.T.Amm)
code working but with one date:
sum({$<[Ord.Original.Req.Date] ={'31/01/2018'}>}Ord.T.Amm)
try this
sum({$< Ord.Campain={"$(=max(Ord.Campain)-1)"}, Ord.Original.Req.Date = {"<=$(=Date(monthend($(vMaxDateAP)), 'DD/MM/YYYY'))"}>}Ord.T.Amm)

Podio API filtering by date range

I'm trying to filter tasks by date range and I'm getting errors whatever I try. This is how my request looks like: http://api.podio.com/task?completed=true&created_on%5Bfrom%5D=2016-06-23&created_on%5Bto%5D=2016-06-28&limit=100&offset=0&sort_by=rank&sort_desc=false&space=4671314
Here I'm trying to filter by created_on and I'm suplying {from: "2016-06-23", to: "2016-06-28"} but it's always returning the same error - invalid filter. I'm trying to filter tasks that are created in the last 5 days here.
The tasks API reference can be found in their API docs.
What am I doing wrong?
Date ranges can be separated by -.
To display "all my tasks created between 1st Jan 2014 and 1st Jan 2016" :-
/task?created_on=2014-01-01-2016-01-01&responsible=0'
Podio API get task filtering by date range use below :
/task/?created_on=2017-04-25-2017-05-01&offset=0&sort_by=rank&sort_desc=false&space=xxxxxxx

Is there a standard way to get previous login date of SAP user?

I've got a requirement to check whether some objects were modified since last logon of current user. There is a table USR02 that contains last logon date, but it is updated at moment of logon and here "last" means "current".
For example, I logged in 2014.11.21 and then 2014.11.26, so dates range I want to get is 21…26, but when I enter the system, date 2014.11.21 in USR02 will be overwritten with 2014.11.26.
Of course, I could follow Z-way and create my own table containing user name and previous login date, but maybe there is there a standard way to achieve this?
I noticed that you can see the current as well as the last logon date and time in the dialog you can open with System --> Status. I went through the code of the function pool SHSY that contains this dialog and found the following implementation:
DATA: BEGIN OF last_logon,
date LIKE sy-datum,
time LIKE sy-uzeit,
date_now LIKE sy-datum,
time_now LIKE sy-uzeit,
END OF last_logon.
* ...
* Datum und Zeit der aktuellen und letzten Anmeldung
GET PARAMETER ID 'US2' FIELD last_logon.
Certainly not the standard API one would expect, but apparently it's all there is...

Calculate end date based on # of days and start date

I am working on script where users can make certain type of orders. Now when users make an order they can choose how long they wont it to last in # of days. Once the order is placed I need to approve their order and that approval date is recorded inside my database. Now what I need is to show inside their user panel how much days their package will last since the day of my approval. So for example if I approved their order September 08, 2013 and they choosed for the order to last 7 days, I wont them to see inside they panel for every next day they login how much days they have left, so 7days, 6days, 5days, etc... all the way to "0 Days" when they come to their panel on September 16, 2013.
I have following variables for those two values:
$row_ordersResults['date'] - the date I approved the order
$row_ordersResults['drip_feed'] - # of days they wont for their order to last
I did tried to lots of combinations by myself but I am totally stuck with this and cant make it work.
Thanks for help!
The libraries at momentjs.com is pretty cool. But if you just wanted something simple to calculate the "date difference" between two time values, there is a relatively simple way to do it. I assume you wanted it done in Javascript.
All you need to do is to clear out the hour/minute/second/millisecond fields of the two dates, calculate their differences in days. Put the script below in any web browser and you'll see how it works.
<script>
function foo() {
var d1 = new Date(2013, 8, 12, 13, 40, 1, 333); // any date value, last 4 params can be anything
var d2 = new Date(2013, 9, 3, 11, 42, 32, 533);
d1.setHours(0); d1.setMinutes(0); d1.setSeconds(0); d1.setMilliseconds(0);
d2.setHours(0); d2.setMinutes(0); d2.setSeconds(0); d2.setMilliseconds(0);
daysLeft = (d2.getTime() - d1.getTime())/(24*60*60*1000);
alert('Dear customer, there is(are) ' + daysLeft + ' day(s) left on your order!' );
}
</script>
Show Remaining Days on Order
EDIT: adding PHP version
<?php
$d1 = New DateTime('2013-08-28 06:25:00');
$d2 = new DateTime(); // now
$drip = 55;
$interval = $d2->diff($d1); // time difference
$days_left = $drip - $interval->format('%a'); // in days, subtract from drip
echo "There are $days_left days left\n";
?>
I hope I don't get marked down for not suggesting a specific answer, but time and date calculations are very tedious and JavaScript's Date() provides limited options. So rather than offer some ugly code, I suggest you take a look at moment.js at momentjs.com. Once you attach the script to your pages, you can easily manage all kind of date formats, and set up a function that will allow you to do math on dates and automatically generate your date ranges - it will even let you format them in to user friendly formats like "in 3 days", which I think is what you want. If your app has anything to do with time, and most do, I can't recommend Moment highly enough.

Getting view options in Microsoft Project using VBA

If I want to change the current date format to 20, for example, I can use the command
OptionsViewEx DateFormat:=20
but how can I get the current date format (or any other view option for that matter)?
DefaultDateFormat should be the function to use.
oldvalue = Application.DefaultDateFormat
Application.DefaultDateFormat = 20 ' or = pjDate_mm_dd_yyyy
This gets or sets the default date format. (technet)
This gives the complete list of format types.
If you use Date function get a date in current format, but if you need change use format(Date,"yyyy-mmmm-dd") for example.