Jekyll - Get the date of the last post - jekyll

I know that i can get the post date with post.date.
But, how i can get the date of the last post or the date related with the last time the website was generated?
I want to echo something like this:
Last update: {{ getDate }}

You want site.time, which will show the exact date/time when the site was last generated:
2015-07-22 17:11:02 +0200
To output the exact date format you want, you can use Liquid's date formatting.
For example, {{ site.time | date: "%-d %B %Y"}} will generate 22 July 2015.

Related

How to return last day of month in ngx-bootstrap datepicker angular

Below is my code where I need to display calendar with month and year and when user selects month and year it should display last day of that month with year. I am able to get the date as 01 June 2022 using below code, where as I need date as 30 June 2022
Quickest way is using a library like moment (depreacated) or dayjs. Take the date you get from datepicker, and use it with the library to get the end date of the month-year.
Change the dateInputFormat to YYYY-MM-DDDD in the bsConfig.
Inside your getDate() function process the datePicker date to get proper format.
Example code:
const date = '2022-06-01';
console.log('Print date: ', moment(date).endOf('month').format('DD MM YYYY'));
Result:

Date-time local sending time from frontend to backend chages automatically and it subtracts the time by 2 hours

I am using the DateTime-local in the HTML field to obtain the datetime from the users. I am sending the same to the backend which I am using to create the XML file. When I send the date to backend it subtracts itself by 2 hours for some reason.
I am not making any changes to it. I am currently in Central European Time (CET), I am guessing its changing automatically to UTC time because CET is 2 hours ahead of UTC. I am just curious to know whats happening here.
I am using the HTML, AngularJS and Nodejs for my project and following are my code samples:
HTML:
<input type="datetime-local" class="form-control" ng-model="formdata.EventTime">
For example, if I selected: 08 October 2020 12:30 PM then after the selection the field would appear something like this: 08/10/2020 12:30
In the AngularJS, just before making the HTTP POST request to my NODE.js I tried to console.log the time and it appeared something like this:
Thu Oct 08 2020 12:30:00 GMT+0200 (Central European Summer Time)
Now finally when I console.log in my Node.js then it appears something like this:
2020-10-08T10:30:00.000Z
I am just curious to know if this is some default functionality?
I could not find similar questions elsewhere so I am posting this.
There's a simple enough reason for the difference. The outputs of both are showing the same instant in time, however the AngularJS log is formatting the date in RFC 2822 format which shows the local timezone, while Node.js is logging the time in UTC formatted as an ISO 8601 time.
If you do this in both AngularJS and Node.js:
console.log(date.toISOString());
You'll get the same output (e.g.)
2020-10-08T10:30:00.000Z
Likewise if you try
console.log(date.toString());
You should get a similar output but in RFC 2822 format (e.g.)
Thu Oct 08 2020 12:30:00 GMT+0200 (Central European Summer Time)
Thanks, #Terry for the response. Based on his answer I did the following, I used the moment to convert my time from UTC to local. My project required me to retain the format of the date and syntax of it.
Install the moment library in Node.js.
When I was selecting 08/10/2020 15:30 in the datetime-local I was getting following date in Node.js:
2020-10-08T13:30:00.000Z
I tried converting it using:
EventTime = moment.utc(EventTime).local().format('YYYY-MM-DDTHH:mm:SS.sss');
Finally I got following output:
2020-10-08T15:30:00.000
I hope if someone else has the same doubt this might help.

How to format date in Angular 4?

App using Angular 4 and bootstrap. I am using an input field that gets the date with month and year (type=month). But when the date saves, I am seeing "yyyy-mm" order. That is fine, but how can I switch the order in the client view to show mm-yyyy or even January 2018?
You would use the date pipe structure:
{{ dateExpression | date: 'mm-dd-yyyy' }}
There is a good short page about it here that you can read and expand on.

MYSQL qlikview assign variable

Im having problems with this.
I have this qlikview script which is run on the 15th of every month. This script intends to automatically take the last date of the previous month in the format of 'YYYY-MM-DD'.
For example today is 15th January 2017. I will run my script and it will give me a date of 31th December 2016 in the format 2016-12-31.
If it is 15th December 2016, I will get 30th November 2016 in the format 2016-11-30.
I want to set the date retrieved as a variable in the format yyyy-mm-dd to be used in another query.
Basically I tried
SET #vLastDate = DATE_FORMAT(select last_day(curdate() - INTERVAL 1 MONTH), '%Y-%m-%d');
but I receive an error that it does not execute. I am doing this in qlikview. Please help me identify my problem thank you.
You are trying to execute mysql functions in qlikview? That won't work.
Try in QV script:
let vLastDate = MonthEnd(AddMonths(Today(),-1));
If you need to change the date format, play around with the Date#() function, probably something like Date#(Field, 'YYYY-MM-DD'). Today() returns YYYY-MM-DD format so it will probably be fine.

How to get current month name in SSRS?

I need current month name as default perameter name in my ssrs report. How can I get current month name using an ssrs expression?
For example "27-09-2012" would become "September"
and one more i need....
27-09-2012 to previous month name as well (August)
First question:
=MonthName(Month(Fields!datefield.Value))
Second question:
=MonthName(Month(DateAdd("m", -1, Today())))
I think the second question answer might be something like that, first converting the date to month then subtracting 1 from the month value and then converting it to month name.
Further reading:
SSRS Reports get Month name from Month Index or from date
Converting month number to month name in reporting services
OFF: I would change the date format you are using to 2012-09-27 as it works in every setting and should give you peace of mind when converting date formats.
Don't subtract 1 b/c it won't work for January.
Use this:
MonthName(Month(DateAdd("m", -1, CDate(Today))))
As a note, I tried the suggestion of =MonthName(Month(today())). What I would get is #error for whatever field the expression was in. However, =MonthName(str(Month(today()))) worked for me. I am unsure of whether or not the MonthName method changed to require a string or if it is some issue with my program. Just figured I would post this in case anyone else was having the same issue.
For Previous Month i found universal way : =MonthName(Month(CDate(Today()))-1,False) for SEPTEMBER (Full Month Name) 'OR'
=MonthName(Month(CDate(Today()))-1,True) for SEP (Short Month Name)