Reset/Clean Up Data Based On Fixed Date/Time In Sheets

I searched online but there’s no solution to this one I could find.

  • as per the sheet attached, there are two tabs: DAILY POSTS and SUBMIT.
  • cells market in yellow colour are where a user would select/enter data during a week
  • all entered data in both tabs should be reset/cleared out automatically at 9am UK TIME every SATURDAY
  • original file contains data in other cells as well, none of that data should be touched by a script, just cells marked in yellow
  • once one sheet is set, copies of it will be made and shared with a few users, for each person to use it as their own
  • even though each user could be in different countries (USA, UK, AU, etc) but all data should still be reset/cleaned up every Saturday for EVERYONE at 9am UK time.

a sheet is attached below, do you know the way, please?

https://docs.google.com/spreadsheets…it?usp=sharing

thanking you in advance.

entities – Allow to filter (in a view) on a datetime field of a custom entity

I have created a custom entity as follow:

Here is an extract of my entity definition in modules/custom/bank_operation/src/Entity/BankOperation.php

Notes:

1- As you can see, I have changed the value of the views_data key

2- The operation_date base field have the datetime type

 * @ContentEntityType(
 *   id = "bank_operation",
 
 ...
 
 *     "views_data" = "Drupalbank_operationBankOperationViewsData",
 
 ...
 
 
class BankOperation extends ContentEntityBase implements BankOperationInterface {

  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {

    ...
    
    $fields('operation_date') = BaseFieldDefinition::create('datetime')
      ->setLabel(t("Operation date"))
      ->setRequired(TRUE)
      ->setSettings((
        'datetime_type' => DateTimeItem::DATETIME_TYPE_DATE,
      ))

    ...
}

Here is an extract of my overrode EntityViewsData in modules/custom/bank_operation/src/BankOperationViewsData.php

This class is used according to the value of the views_data key. This is my attempt to allow a view to filter on the operation_date field

class BankOperationViewsData extends EntityViewsData {

  public function getViewsData() {
    $data = parent::getViewsData();
    $data('bank_operation')('operation_date')('filter') = (
      'id' => 'datetime',
      'field' => 'operation_date',
      'table' => 'bank_operation',
      'field_name' => 'operation_date',
      'entity_type' => 'bank_operation',
    );
    return $data;
  }

}

After that, I have created a view to display my BankOperation entities with an exposed filter on the operation_date field.

Here is the error produced when using this filter (I don’t understand why ViewsYearFilterDatetime is called)

Exception: DateTime object not set. in DrupalComponentDatetimeDateTimePlus->__call() (line 360 of core/lib/Drupal/Component/Datetime/DateTimePlus.php). 

DrupaldatetimePluginviewsfilterDate->opSimple() (Line: 63)
Drupalviews_year_filterPluginviewsfilterViewsYearFilterDatetime->opSimple() (Line: 330)
DrupalviewsPluginviewsfilterNumericFilter->query() (Line: 1373)
DrupalviewsViewExecutable->_build() (Line: 1262)
DrupalviewsViewExecutable->build() (Line: 390)
DrupalviewsPluginviewsdisplayPathPluginBase->execute() (Line: 180)
DrupalviewsPluginviewsdisplayPage->execute() (Line: 1630)
DrupalviewsViewExecutable->executeDisplay() (Line: 77)

I know that there are other questions like this one, but none of them are providing a detailed answer (only links).

I have setup my question to allow people who are facing the same issue to quickly find a path to solve it.

Is there a shortcut to insert current datetime as a static value in a cell in Google Sheets?

I have a table like this:

Expense Date What it was for
120 CZK 4.5.2021. 12:30 Pizza coz I’m lazy

I use it to log some expenses, not exactly for pizza but that’s just an example. I also have similar tables where I really NEED both date and time.

I found out that Ctrl+; inserts current date, but without time. Is there also a shortcut for both date and time?

datetime – Office Hours in PostgreSQL

How to store office hours in PostgreSQL rows, so that I can calculate the office hours.

Example:

  • We have open from 9:00 to 18:00 from Monday till Friday.
  • Saturday we have open from 10:00 to 15:00
  • from 24. Dec to 31. Dec we have open from 10:00 to 13:00 (but not on Saturday and Sunday)
  • All above rules are valid until 31. Dec 2021.
  • Starting from 01. January 2022 we have open from 10:00 to 18:00 from Monday till Friday. Saturday is open like before.

I would like to store this data in rows, so that we can develop an interface for it.

And then there needs to be a method which uses the rows/rules to calculate the specific opening hours.

Different timezone are not important in this context.

datetime – I want to use dd/mm/yy as date format in a custom form instead of default mm/dd/yy

I am using the following date form element.

$form('dobnew') = (
  '#type' => 'date',
  '#title' => t('Birth Date new'),
  '#date_date_format' => 'd/m/Y',
  '#default_value' => date('d/m/Y'),
  '#required' => TRUE,
);

The date widget I get is the following one.

screenshot

What exactly is the datatype input into a DATETIME value in MySQL

I am trying to get data from a PLC directly into a MySQL 8.0 database. I need to know what data type the input value is for a column set to DATETIME so I can send in the right format.

Actual question: I assume it’s string, because when I manually input values using and INSERT, the value has to be in ‘ ‘. Is this a stupid assumption on my part?

When the output of my PLC is a string, what I read from a SELECT in my DB is completely wrong “1905-07-13 00:00:00” instead of “2021-04-30 08:51:30”. Another assumption I’m making here is that the input datatype is what’s causing this problem, but as it is now, DATE and DATETIME are not supported by the driver I’m using so maybe it’s just wishful thinking.

Note: Please do migrate this if it’s off topic, wasn’t really sure if it was a best fit here or stack overflow…

¿ Por qué tengo este error: date/time field value out of range en NODE/EXPRESS?

Node/express me muestra este error: date/time field value out of range: "2021-29-04"
Los datos llegan al servidor, aca les muestro cuando le envio los datos:

introducir la descripción de la imagen aquí

y aca cuando los recibe node/express

introducir la descripción de la imagen aquí

controller.ts

export const createOperation = async (req: Request, res: Response): Promise<Response> => {

  if (!req.body) {
      return res.status(400).send({
        message:
          "FALTA CONTENIDO EN EL CUERPO"
      });
  }

  const {
      userEmail,
      concept,
      amount,
      date,
      type,
      category,
  } = req.body;

  const _amount = parseInt(amount);

  const a = "INSERT INTO public.alkemy_operations(";
  const b = "user_email, concept, amount, date, type, category)";
  const c = " VALUES ($1, $2, $3, $4, $5, $6);"
  const query = a + b + c;

  console.log(req.body);

  try {
    // insert en PostgreSQL
    await pool.query(
      query,(userEmail, concept, _amount, date, type, category)
    );
    return res.status(200).json(`The operation was inserted successfuly`);
  } catch (e) {
    console.log(e);
    return res
      .status(500)
      .json("error to insert operation");
  }
    
};   

c# – When Receiving/Returning data in controller action – DateTime conversion between UTC and Epoch in Asp.net core WebAPI

I was wondering what would be a better approach designing a system which deals with UTC DateTime in the service and Database layer but needed to send and receive the DateTime in Epoch format from remote agents.

Consider the following Class (model):

public class UserProfile
{
    (DataType(DataType.EmailAddress))
    public string Email { get; set; }

    public DateTime SomeDate { get; set; }
}

Now if if the APIs needs the value of the SomeDate to be in Epoch format (like Dotnet long type instead of DateTime but the system needs to have the data in UTC DateTime format to process and store in the service codes.

Considering there would be many REST APIs and different models, what would be a global solution to handle the issue. Can this be solved with auto mapper or action filter or something like that?

Is there a way to get, programatically, the datetime of the last update to a google spreadsheet?

In our system we have google spreadsheets which content editors use. I have some processes which pull these down and save them as local csv files, so the data can be read in by the system.

It would be very useful to know, when the system comes to use that data, whether it needs to be re-downloaded, and I thought that if I could somehow retrieve the “updated_at” timestamp for the google spreadsheet I could use that as the basis of a decision on whether to re-download the data.

Is there a way to get this, does anyone know? I’m using Ubuntu.

Is there a way to get, programatically, the datetime of the last update to a google spreadsheet?

In our system we have google spreadsheets which content editors use. I have some processes which pull these down and save them as local csv files, so the data can be read in by the system.

It would be very useful to know, when the system comes to use that data, whether it needs to be re-downloaded, and I thought that if I could somehow retrieve the “updated_at” timestamp for the google spreadsheet I could use that as the basis of a decision on whether to re-download the data.

Is there a way to get this, does anyone know? I’m using Ubuntu.