Skip to content

Tag: php

Calculate the first day of next month and quarter from today in PHP

For calculating the first dayof next month from today: How to calculate the first day of next quarter from today? First quarter, Q1: 1 January – 31 March Second quarter, Q2: 1 April – 30 June Third quarter, Q3: 1 July – 30 September Fourth quarter, Q4: 1 October – 31 December Thank you! Answer There may be mo…

Laravel – convert time to user’s timezone in model

I have the following model that returns data from Dynamo AWS, my data has a time in EPOCH, and I convert it to the formatted date as below: However, the time returning does not match the time that the user is seeing the data and that is why I would like to make the conversion using the registration timezone a…

Symfony reusable AJAX select / ChoiceType

I want to create a reusable AJAX-based select (select2) using Symfony form types and I’ve spent quite some time on it but can’t get it to work like I want. As far as I know you cannot override options of form fields after they have been added, so you have to re-add them with the new config. The Sy…

Posts not ordering by post__in

I am trying to display 3 blog posts that have been selected by the user in the admin. The order should go gridItem1, gridItem2 then gridItem3. I have set out my query below but it shows the selected posts but in date order not in the order I have outlined. I have searched other posts and added in the ‘s…