Regarding https://github.com/icalendar/icalendar/pull/132: Given that I have a
#cal = Icalendar::Calendar.new
How do I use Icalendar::HasComponents to add X-WR-CALNAME, X-PUBLISHED-TTL and X-WR-CALDESC properties to #cal?
I want to generate these extra properties in my .ics file so that I could add it to Google Calendar and Outlook and allow them to specify
X-WR-CALNAME - calendar name
X-PUBLISHED-TTL - refresh interval
X-WR-CALDESC - calendar description
It's simpler than I thought:
cal = Icalendar::Calendar.new
cal.append_custom_property("X-WR-CALNAME","My Calendar")
cal.append_custom_property("X-PUBLISHED-TTL","PT1H") # every hour
cal.append_custom_property("X-WR-CALDESC","My Desc")
Reference: https://github.com/icalendar/icalendar/blob/master/lib/icalendar/has_properties.rb
Related
I am able to get SITELINK assets from Google Ads API with the following query:
SELECT
campaign_asset.campaign,
campaign_asset.status,
asset.sitelink_asset.link_text,
asset.final_urls,
asset.final_mobile_urls
FROM
campaign_asset
WHERE
campaign_asset.status = 'ENABLED'
AND campaign_asset.field_type = 'SITELINK'
However, this includes Sitelinks from paused adgroups - which i don't want.
I am searching for a solution to filter out Sitelinks from paused adgroups.
I already tried with additional WHERE clause
asset.sitelink_assets.end_date > 'yyyy-mm-dd'
(yyyy-mm-dd is todays date)
This works .. somehow, .. but it also excludes sitelinks without end date - which i want to be included.
I would expect to have an option to filter by asset status... but i can't find something like that in the official GAQL documentation.
I'm finding a webtool to generate a Google Calendar link event with a repeat parameters. For example I would like to create an event with this data:
Title: Example event
Location: Office
Description: This is a description of an example event.
Start Date: 01/10/2021
Start Time: 10:00:00h
Repeat at: each months.
I have found URL as like:
https://jennamolby.com/google-calendar-link-generator/
But in this URL I cann't to set a repeat parameter.
An URL example without repeat time event parameter is this:
http://www.google.com/calendar/event?action=TEMPLATE&dates=20211001T100000Z%2FT010000Z&text=Example%20event&location=Office&details=This%20is%20a%20description%20of%20an%20example%20event.%20
I would like to find documentation about all possible parameters to create Google Calendar events.
Thanks.
The parameter to insert a repeat event is:
&recur=RRULE:FREQ%3DMONTHLY&sf=true
In this example the repeat is monthly.
How to get last modified date of a sharepoint group.
how to get date when a user is added to a sharepoint group.
thanks for your help.
Arvind
You can get the "Creation" and "Last Modified" Date through following Code:
SPList groupInformationList = SPContext.Current.Web.SiteUserInfoList;
SPListItem grpItem = groupInformationList.Items.GetItemById(group.ID); // Pass the ID of group
// OR, SPListItem grpItem = web.SiteUserInfoList.GetItemById(web.SiteGroups["group_name"].ID);
string groupCreationDate = Convert.ToDateTime(grpItem[SPBuiltInFieldId.Created]).ToString("MM/dd/yyyy hh:mm tt"); //Group Creation Date
string groupLastModifiedDate = Convert.ToDateTime(grpItem[SPBuiltInFieldId.Modified]).ToString("MM/dd/yyyy hh:mm tt"); // Group Modification Date
I do not know of an out of the box way to do this. The SPGroup and SPUserCollection classes do not contain dates. And even looking in the content database (which is unsupported), neither the Groups or GroupMembership tables have dates.
I have a database table TableA, which has a column 'theDate' for which the datatype in the database is DATE.
When I save a java.util.Date to 'theDate' through GORM it appears to save just the date value when I look at the data in the table by just executing select * from TableA.
However, when I run a query such as:
select * from TableA where theDate = :myDate
No results are found, but if I run something like;
select * from TableA where theDate <= :myDate
I do get results.
So it's like the Time is relevant.
My question is how do I save a Date and query for a Date ignoring the Time completely and just matching on an exact Date only?
Thanks.
note: I have also tried using sql.Date and util.Calendar but to no success.
clearTime()
You can use clearTime() before saving and before comparing to zero out the time fields:
// zero the time when saving
new MyDomain(theDate: new Date().clearTime()).save()
// zero the target time before comparing
def now = new Date().clearTime()
MyDomain.findAll('SELECT * FROM MyDomain WHERE theDate = :myDate', [myDate: now])
joda-time plugin
An alternative would be to install the joda-time plugin and use the LocalDate type (which only holds date information, no times) instead of Date. For what it's worth, I don't think I've worked on a project with dates without using the Joda plugin. It's completely worth it.
If you have date saved without clearing you could retrieve it using range, as Jordan H. wrote but in more simple way.
def getResults(Date date) {
def from = date.clearTime()
def to = from + 1
def results = MyDomain.findAll("from MyDomain where dateCreated between :start and :stop" ,[start:from,stop:to])
}
Your question may be a duplicate. See Convert datetime in to date. But if anyone has more recent information, that would be great.
If that doesn't help, you can hack it the way I might, with a BETWEEN restriction, e.g.
def today = new Date()
def ymdFmt = new java.text.SimpleDateFormat("yyyy-MM-dd")
def dateYmd = ymdFmt.format(today)
def dateTimeFormat = new java.text.SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
def startDate = dateTimeFormat.parse("${dateYmd} 00:00:00");
def endDate = dateTimeFormat.parse("${dateYmd} 23:59:59");
MyDomain.findAll("from MyDomain where dateCreated between ? and ?", [startDate, endDate])
It's definitely not pretty, but it may get you where you're going.
I figured it out.
I used DateGroovyMethods.clearTime to clear the time value before saving.
You can use the DB type date not datetime , in the filed type
I am using the below to setup an event to export to ical with the icalendar gem.
#calendar = Icalendar::Calendar.new
event = Icalendar::Event.new
event.dtstart = ev.start_at.strftime("%Y%m%d")
event.dtend = ev.end_at.strftime("%Y%m%d")
event.summary = ev.summary
#calendar.add
In order to make an event all day it needs to look like this:
DTSTART;VALUE=DATE:20101117
DTEND;VALUE=DATE:20101119
Right now I am using
event.dtstart = "$VALUE=DATE:"+ev.start_at.strftime("%Y%m%d")"
This will output
DTSTART:$VALUE=DATE:20101117
and then I replace all ":$" with ";" with
#allday = #calendar.to_ical.gsub(":$", ";")
Is there a more direct way to save dates as all day?
I played around with this and figured out one way. You can assign properties to the event dates, in the form of key-value pairs. so you could assign the VALUE property like so:
event = Icalendar::Event.new
event.dtstart = Date.new(2010,12,1)
event.dtstart.ical_params = { "VALUE" => "DATE" }
puts event.to_ical
# output
BEGIN:VEVENT
DTSTAMP:20101201T230134
DTSTART;VALUE=DATE:20101201
SEQUENCE:0
UID:2010-12-01T23:01:34-08:00_923426206#ubuntu
END:VEVENT
Now the fun part. Given a calendar you can create an event and pass in a block which initializes the date with its properties:
calendar.event do
dtstart Date.new(2010,11,17), ical_params = {"VALUE"=>"DATE"}
dtend Date.new(2010,11,19), ical_params = {"VALUE"=>"DATE"}
end
So this thread seems quite old (and did not solve the problem with the most recent version of the icalendar gem - 2.3.0). I've recently had to create "all day" calendar events in ics format. I've found this to be a much better solution (and seems to work the way you'd expect calendars to handle it) - see the snippet below
date = Date.new(2010,11,17)
event = Icalendar::Event.new
event.dtstart = Icalendar::Values::Date.new date
event.dtstart.ical_param "VALUE", "DATE"
event.dtend = Icalendar::Values::Date.new (date + 1.day)
event.dtend.ical_param "VALUE", "DATE"
puts event.to_ical
The above code produces the following output:
BEGIN:VEVENT
DTSTAMP:20150521T162712Z
UID:4c239930-15ba-44b4-a045-c6fae3d858d2
DTSTART;VALUE=DATE:20101117
DTEND;VALUE=DATE:20101118
END:VEVENT
Note that the Date does not have a time associated with it. The code in the prior reply currently produces the time. I had to dig into the source code for icalendar to figure out this solution.
I hope this helps someone else.
Cheers!