How can a custom Drupal date format be added? - drupal

How do you add a custom Drupal date format. I want to display the date without hours and minutes, but the options don't include it.

Do the following:
Administration » Configuration » Regional and language » Date and Time
There you will see a tab for format.
Create a new format string "Y-M-d".
Make this as your default for all date fields and you won't see the seconds any more.
You don't need the date module for basic formatting.
Cheers,
Vishal
Below is the image so that you know where it is.

You will see a button Add format in this path admin/config/regional/date-time/formats
Then, type your format there. This will help you: http://php.net/manual/en/function.date.php
After adding your format, you can choose in the tab Types
Oops. I had this tab open in my browser for long time and didn't see the other answer.

Related

2sxc: Field Date and Time default value

I need to have in my fields a datetime content type.
Looking for documentation I found same here http://2sxc.org/en/Docs-Manuals/Feature/feature/2874
Date and Time
no relevant settings to explain. Note that the
output-template will usually choose to show only the date, only the
time etc.
So it's the same data-field no matter what you're actually
entering.
How can I set a default date value like a Datetime.Now for the editing input data field?
I tryed with varius commands but it gives me invalid date.
I alsa tryed the dnn token [DateTime: Now] but it doesn't work.
Thanks
To prefil the date-time there are two options
the link in the dnn-page which creates a new-item could pass this in as a prefill - http://2sxc.org/en/Docs-Manuals/Prefill-new-Forms
there is a hidden API which could do it using JavaScript, but it's not official yet, fairly technical and still prone to change. So I would use #1

Change date format from default

I have one problem. In code I have set the format for display the date time as below image:
But the result still show as below format:
How can I change the format for this problem.
You can't do it using pure HTML, You can use combination of jQuery and Masked input plugin like
jQuery(function($){
$("#date").mask("99/99/9999",{placeholder:"mm/dd/yyyy"});
});
try to use the
String.Format method
something like this:
Convert.ToDateTime(String.Format(yourDate.ToLongDateString(), "dd/MM/yy"))
You can't change this format
It gets the format from the OS. The input format will be varying depending on the international settings of the OS. It could also depend on the browser and the OS of the client computer too.
According to this question
We have to differentiate between the over the wire format and the
browser's presentation format.
Wire format The HTML5 date input specification 1 refers to the
RFC3339 specification [2], which specifies a full-date format equal
to: yyyy-mm-dd. See section 5.6 of the RFC3339 specification for more
details.
Presentation format Browsers are unrestricted in how they present a
date input. At the time of writing Chrome has the most extensive date
support [3]. It displays a date picker using the user's local calendar
format. Opera (v10.6+) also displays a date picker, but shows the date
in the wire format. Other browsers, such as Firefox 24 and Internet
Explorer 9/10 display a text input field with the wire format.
References
1 http://www.w3.org/TR/html-markup/input.date.html
2 https://www.rfc-editor.org/rfc/rfc3339
3 https://plus.google.com/102860501900098846931/posts/hTcMLVNKnec

Mandrill Templates With Handlebars - How To Format Date

Mandrill has a great feature that allows one to use Handlebars in templates to customize email content. See docs here.
One of the helpers that Madnrill supports is date that can be used like {{#date}}. The default date format is d/m/Y. My question is how can I specify a different date format (e.g. yyyy)?
I need to display something like 2015 Name. I tried:
{{#date yyyy}} Name - displays 05/31/15 (default format and seems to erase any HTML after it).
{{#date 'yyyy'}} Name - displays {{#date 'yyyy'}} Name (can't be parsed).
{{#date yyyy}}{{/date}} Name - displays 05/31/15 Name (default format).
{{#date 'yyyy'}}{{/date}} Name - displays {{#date 'yyyy'}}{{/date}} Name (can't be parsed).
Appreciate you help ;)
The issue was 2-fold:
You should use {{date}} instead of {{#date}}
You should use double quotes for formatting
The correct syntax would be {{date "Y"}}.
Mandrill also updated their docs that now provide more details on handlebars syntax.
I would assume this may follow the original Merge Tag formatting. Have you tried this?
http://kb.mailchimp.com/merge-tags/all-the-merge-tags-cheatsheet
Use |DATE:FORMAT| to show the current date in a given format. For example, |DATE:d/m/y| where d is replaced by the day, m by the month, and y by the year. View a full reference of date options on the PHP website. This format isn't available for automation workflows.

invalid date syntax with ajax calendar

I had Ajax calendar and when I selected from it it give me date as (07/12/2010)
and when I made space between the year and / it converted to (2010/07/12) and this invalid date so pleas what the error.
That's not a error is it? It sounds to me like the Ajax is just setting the date as a culture invariant. See this article on CodeProject
Try Specifying the date Format by using calendar Format property to "dd/MM/yyyy"
http://www.ajaxlines.com/ajax/stuff/article/aspnet_ajax_calendarextender_and_validation.php
Check out http://www.ama3.com/anytime/
If you are working from JS you would be better off working from its numeric (epoch) representation and then convert it to whatever format you want to use or use the js date api to achieve what you want.
https://developer.mozilla.org/en/JavaScript/Reference/global_objects/date

Drupal: How to format email message using node invite module?

I am using the node invite and token module.
I have followed this flash tutorial video: http://www.adevbox.com/files/2008-06-25_1703.swf
My problem is regarding the email format being sent.
In the ?q=admin/settings/node_invite
I have checked the blog entry checkbox. Now the node invite works but I can't format my body section value correctly.
For example:
I entered in the textarea
Hi <bold>
Then the result when I open the email message is still the same:
Hi <bold>
Same with if I use <b>bold here</b> then it will also be the format when I open the email message.
How can I format it correctly? Am I missing something simple? I am thinking of using htmlspecialchars but I don't where to put it.
Thanks in advance :)
Kind Regards,
Mark
My understanding of the Invite module is that there is no Input Filter for the template. This means that the only format that is accepted is plain text. This means that it will convert HTML into the escaped code you see.
You can validate this looking at the variables in the database. Your best bet it so path Invite (or ask for a features) to allow HTML as a valid format.

Resources