I am using cratejoy to create a 'subscription boxes' based website.It used jinja2 as its templating engine.
Now I am editing email templates where I want to access order items and send my customized messages.
My question is how to do date related operations using jinja2 syntax just as getting-
date on next monday,
next month name,
first monday of next month etc
I am able to do everything easiliy with javascript but it wont be helpful since email clients wont run JS.
Any help will be appreciated !!
Related
I am using a date token, which is filled in a signup form. I would like to do conditional logic, based on whether the date is less than 2 weeks away from today. I would like to do something like the below
*|IF:CHECKINDATE<TODAY+20DAYS|*
This is the code for your accommodation: 123456789
*|END:IF|*
Do you know if it is possible?
Context: I am using Microsoft Dynamics (CRM) and Eloqua to send email campaigns. I have a date field in CRM that I want to check against in Eloqua for a specific campaign. This campaign needs to check to see if the date field is <= today's date + 90 days. I am using the campaign UI in Eloqua, not doing anything programmatically at this point.
I have tried using the Compare Custom Object Fields decision in Eloqua by finding the date field, setting the comparator to dynamically on or before, and I want to make the compared value Today + 90 days. I'm not sure how to accomplish this in this type of Decision object because the only options I have to compare the date field to are Yesterday, Today, or Tomorrow. See image below:
I have also tried to use the Compare Date Decision object, but there is no dynamic comparison, just hard-coded date options.
The last thing I tried was a Wait step, but that only waits a hard-coded number of days rather than checking dynamically.
Has anyone run into this issue or know of a solution to this problem?
We were able to find an Eloqua Date App to download that adds a Date Decision step to the program builder which allowed us more flexibility with comparing dates in a custom range.
I am a novice at coding and running scripts and was wondering the following;
Context: I run scripts in one of my companies programs to create customer service tickets.
Question: Is it possible to automatically update the date for a line of code in a script to the current day's date in MMDDYYYY format?
As of now I manually go and change the date for each script every day.
EX of (part of) script:
send "TKTE/R02252016"
Is there a way to automatically update the "02252016" to the current day's date?
I currently use Notepad/Wordpad for the scripts but can get Notepad++ if this is a possibility.
Thank you for your time and insight.
Within Notepad++, you can search by means of a regular expression.
Search for TKTE/R\d{8} and replace it with TKTE/Rmmddyyyy, where mmddyyyy is the current date.
How to protect only Month and Year of a date in Powerbuilder so user can only edit day of the date?
As comments suggest, this reads more like a user requirement than a technical question (e.g. lack of mention of what type of control is involved), but if this were my requirement, I'd try one of these (user exercise to figure out which ones would actually work; it's not my requirement grin).
EditChanged: I'd put a date EditMask on a DataWindow (remember external DataWindows; it's a common misconception to think that controls on DataWindows have to be tied to a database column), and code the EditChanged to revert the year and month back to their set values if they've been changed. (I'd consider this pretty aggravating for the user, but it's possible)
Day field: Make the year and month StaticText, and make the day only an editable field. Edit, EditMask or EditMask with spin control would be appropriate for this (spin gives you control over the range with minimal scripting).
Custom control: Grab the source code for a dropdown calendar (PFC comes to mind), and customize it to disable the navigation between years and months.
Good luck,
Terry
Upon logging into their accounts, each user has their login date and time stored to the database. What I was looking to do however is figure out the amount of days (or preferably convert into months if greater than a month) so that if a user views their profile they can see how active the band are. Also, this could benefit me in terms of keeping active profiles top of the agenda for content on the site so that it doesn't become stale from inactive users content filling up main page content.
I'm using ColdFusion so i'd be looking for a way to find for example how many days ago #lastLogin# was from #now()#. So say if the date of the last login was 23/04/2013 and todays date is 29/04/2013 it would read "Last Active, 1 day ago." However if the last login was 23/03/2013, it would read "Last Active, 1 month ago".
Anybody know how to do this? Thanks.
P.S I currently have no code from testing this as I have no idea where to start in terms of achieving this.
Use DateDiff
<cfset days = dateDiff("d", LoginDateVariable, now()) />
It's as simple as that.
P.S I currently have no code from testing this as I have no idea where
to start in terms of achieving this.
This doesn't answer your direct question but to help you know where to get started, I would strongly suggest reviewing the built in ColdFusion functions and tags that are available to you.
Tags
Tags by function
Functions
Functions by category
Also, Google searches usually land you at the docs, just add "coldfusion" to your search string. Searching google for coldfusion date functions yields very helpful answers, the first of which are a list of all ColdFusion date functions.
Dale's answer is spot on. But I would also suggest returning it as a variable with your query. Let the SQL server do the work. It's very efficient for those types of calculations. Not that CF can't do them well, too. But it's probably more appropriate for SQL to do that lifting. Especially if you're already returning the lastLogin date.
It would be similar to the CF solution:
SELECT ...., lastLogin, DATEDIFF(d, lastLogin, GETDATE()) AS LastLoginDays
FROM ....
WHERE ....
That would give you the number of days. You'd have to decide how you wanted to define a month if you wanted to break it out by month/day. That would get a bit more complex. You could write a SQL function that could be run on both dates and give you an accurate count of days/months/years since last login.
One other thing to keep in mind: Where are the dates being generated? When you insert loginDate into the database, are you doing a now() in CF before you insert it or are you doing a getDate() in SQL when you insert it? Again, I would let the database do your date logic, but you'd want to compare the two dates from the same source. For instance, if your loginDate was a database getDate() then you may not want to compare that to a CF now(). One goes by the datetime of the SQL server and the other goes by the datetime of the CF server. They could be different.