Batch Shift Year Only Meta Date Earlier with ExifTool

Have a few thousand tiff photos I’ve scanned in over the past few years into Lightroom Classic. For reasons I won’t go into here since not relevant to the question, I’d like to change the year for all photos to be 45 years earlier than what they currently are but want the month day hour and seconds to all stay as they are.

Lightroom has an ExifTool plugin but the docs don’t have an example for just shifting only the year back by a certain number.

Something maybe like.. exiftool “-AllDates-=45:0:0:0:0” but with only changing year.

The Launch Date Of This NBA 2K21 Game

The launching date of 2K MT is closing in and new information has surfaced with each passing day for fans to enjoy. These days, the trailer for MyCareer mode fell, and it’s nothing short of stunning.

Several adjustments were anticipated in the mode and by the looks of this, the developers seem to have pulled them off. Players may now begin their journey as a high school prospect and climb their way up into the NBA. In addition, the neighborhood has a new look for it after having been stale for some time.

Let’s have a peek at a few of the newest features that Buy NBA 2K21 MT will bring to the table. If they function well on a high school contract, they can earn a contract to play for the NCAA tournament. Although not all faculty teams are featured, there are still 10 choices to pick from. Furthermore, picking different brokers are going to have an impact on the livelihood and popularity.
SEMrush

 

io – How to implement simple Date class in C++? Edit: And use that class with [i/o]stream_iterators

I would like to know how can I improve my simple Date class in C++. I am reading https://www.amazon.com/Exceptional-Engineering-Programming-Problems-Solutions/dp/0201615622 and the very first example handle with a Date object, but provide no implementation. So I tried to implement it myself:

Date.hpp:

#ifndef DATE_HPP
#define DATE_HPP

#include <sstream>
#include <time.h>

#define fmt "%m/%d/%y"

class Date
{
    std::stringstream buffer;
    struct tm date;

    template <class T>
    void insertbuf(const T &);
    void inserttime();
    std::string getFromIn(std::istream &);

public:
    //ctors
    Date();
    Date(const char *str);
    Date(const std::string &s);
    Date(std::istream &in);
    Date(const Date &d);

    //operators
    Date &operator=(const Date &rhs);

    //friends
    friend std::istream &operator>>(std::istream &, Date &);

    //general
    const std::string getAll() const;
    int getMonth() const;
    int getDay() const;
    int getYear() const;
    void clear();
};

std::istream &operator>>(std::istream &in, Date &d);
std::ostream &operator<<(std::ostream &out, const Date &d);

#endif //DATE_HPP

and its implementation:
date.cpp:

#include <time.h>
#include "date.hpp"
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <ctype.h>

std::string &ltrim(std::string &s)
{
    s.erase(s.begin(), std::find_if(s.begin(), s.end(),
                                    std::not1(std::ptr_fun<int, int>(std::isspace))));
    return s;
}

std::string &rtrim(std::string &s)
{
    s.erase(std::find_if(s.rbegin(), s.rend(),
                         std::not1(std::ptr_fun<int, int>(std::isspace)))
                .base(),
            s.end());
    return s;
}

std::string &trim(std::string &s)
{
    return ltrim(rtrim(s));
}
////

template <class T>
void Date::insertbuf(const T &val)
{
    if (!buffer.rdbuf()->in_avail())
    {
        buffer << val;
    }
}

void Date::inserttime()
{
    buffer >> std::get_time(&date, fmt);
}

std::string Date::getFromIn(std::istream &in)
{
    std::cout << "Enter date in format (mm/dd/yyyy): ";
    std::string tmp;
    std::getline(in, tmp);
    tmp = trim(tmp);
    return tmp;
}

void Date::clear()
{
    buffer.str("");
    buffer.clear();
}

Date::Date()
{
    time_t now = time(0);
    struct tm *tmp = localtime(&now);
    date = *tmp;
    insertbuf<std::_Put_time<char>>(std::put_time(&date, fmt));
}

Date::Date(const char *str)
{
    insertbuf<const char *>(str);
    inserttime();
}

Date::Date(const std::string &s)
{
    insertbuf<std::string>(s);
    inserttime();
}

Date::Date(std::istream &in)
{
    std::string input = getFromIn(in);
    insertbuf<std::string>(input);
    inserttime();
}

Date::Date(const Date &d)
{
    date = d.date;
    insertbuf<std::string>(d.buffer.str());
    inserttime();
}

Date &Date::operator=(const Date &rhs)
{
    if (&rhs != this)
    {
        clear();
        insertbuf<std::string>(rhs.buffer.str());
        inserttime();
    }
    return *this;
}

const std::string Date::getAll() const
{
    int mon = date.tm_mon + 1;
    int day = date.tm_mday;
    int year = date.tm_year + 1900;
    std::string out = std::string("date: ") + std::to_string(mon) + "/" + std::to_string(day) + "/" + std::to_string(year);
    return out;
}

int Date::getMonth() const
{
    return date.tm_mon + 1;
}

int Date::getDay() const
{
    return date.tm_mday;
}

int Date::getYear() const
{
    return date.tm_year + 1900;
}

std::istream &operator>>(std::istream &in, Date &d)
{
    d.clear();
    std::string tmp = d.getFromIn(in);
    d.insertbuf<std::string>(tmp);
    d.inserttime();
    return in;
}

std::ostream &operator<<(std::ostream &out, const Date &d)
{
    out << d.getAll();
    return out;
}

Can If I use it main.cpp:

#include <sstream>
#include <iostream>
#include <iomanip>
#include <time.h>
#include "date.hpp"
#include <vector>
#include <iterator>
#include <algorithm>

using namespace std;

struct Functor
{
    Functor(const std::string &s) : s_(s) {}
    bool operator()(const Date &d) const
    {
        return d.getAll() == s_;
    }

private:
    const std::string &s_;
};

int main()
{
    vector<Date> e;

    copy(istream_iterator<Date>(cin), istream_iterator<Date>(), back_inserter(e));

    vector<Date>::iterator first = find_if(e.begin(), e.end(), Functor("01/01/2020"));
    vector<Date>::iterator last = find_if(e.begin(), e.end(), Functor("12/31/2020"));

    copy(first, last, ostream_iterator<Date>(cout, "n"));
}

It compiles, it runs. But the problem is it will not output the proper data. If I were to test individual operations such as operator>>, like

Date foo;
std::cin >> foo;

It works correctly. But somehow inside the copy algorithm, which uses istream_iterator and ostream_iterator the information about the date (in struct tm got lost). But otherwise, the class works as expected.

EDIT:
Please use the original main function with (i/o)stream_iterators used. It is part of the question.

Best way to bin pandas dataframe by date?

I have code like:

# Seperate tweets by day
day_one = '2020-11-16 00:00:0'
day_two = '2020-11-17 00:00:0'
day_three = '2020-11-18 00:00:0'
day_four = '2020-11-19 00:00:0'
day_five = '2020-11-20 00:00:0'
day_six = '2020-11-21 00:00:0'
day_seven = '2020-11-22 00:00:0'

date_col = tweet_df('created_at')

day_one_tweets = tweet_df.loc((date_col >= day_one) & ( date_col <= day_two))
day_two_tweets = tweet_df.loc((date_col >= day_two) & ( date_col <= day_three))
day_three_tweets = tweet_df.loc((date_col >= day_three) & ( date_col <= day_four))
day_four_tweets = tweet_df.loc((date_col >= day_four) & ( date_col <= day_five))
day_five_tweets = tweet_df.loc((date_col >= day_five) & ( date_col <= day_six))
day_six_tweets = tweet_df.loc((date_col >= day_six) & ( date_col <= day_seven))

Is there a what to do this programmatically so it’s scalable without typing each day?

google sheets – Formula to output the date for next Friday once it has passed 20:00 on Friday

Alsors, try this:

=ArrayFormula(IF((WEEKDAY(TODAY())=6)*(NOW()-TODAY()>=TIMEVALUE("8:00 PM")),TODAY()+7,FILTER(SEQUENCE(7,1,TODAY()),WEEKDAY(SEQUENCE(7,1,TODAY()))=6)))

HOW IT WORKS

The formula assumes Sunday is counted as weekday 1 and, therefore, that Friday is counted as 6.

The first part of the IF checks to see if two conditions are true: That today is Friday and that the current time is greater than or equal to 8:00 PM. If those are both TRUE, then the date is set to seven days in the future (i.e., next Friday).

If this small window of time is not the case, then the second half of the IF statement takes effect. A SEQUENCE is formed of seven dates starting with today’s date. FILTER filters in only those days whose weekday is 6 (i.e., Friday). And since there will only be one Friday within any seven-day SEQUENCE of dates, it will pull whatever the “next Friday” is.

(Note: If today is Friday before 8:00 PM, then the “next Friday” in the SEQUENCE is today, so it stays showing today’s date until after 8:00 PM.)

google sheets arrayformula – =IMPORTHTML forces content to date format

I am a beginner with code and formulas here, so I was wondering if anyone could do exactly what was done on this question:

Trying to use Google Sheets importHTML() to import a table. It forces content to a date format

to this table:

https://www.actionnetwork.com/nfl/nfl-against-the-spread-standings

In short, IMPORTHTML changes sports records to date format. Changing the numbers format to plain text does not work when importing websites, as the format is preset. However, there is a workaround using the ARRAYFORMULA and REGEXREPLACE. When you open the link scroll down to Aurielle’s response for the single formula version. I have tried to implement the workaround for the NFL record link above, but I can’t quite find the right formula mostly because, again, I’m a beginner and I don’t understand these formulas. I was wondering if anyone understood this better and could give me the correct formula for this specific table of NFL records.

I would greatly appreciate any help!

filesystem – Create/delete files without changing directory’s modified date (crosspost from unix.stackexchange)

(crosspost from unix.stackexchange)

I want to remove a number of files, without touching the containing directories’ modified date.

I know I can simply stat the directory in question first, take a note of the modified time, and then manually reset it with touch -d after I’m done, but that seems unnecessarily cumbersome.

Specifically, I’m hoping to get an answer to two questions:

  1. Is it possible to temporarily ‘freeze’ the updating of changed/modified/access dates (either on a per-directory basis or for the whole filesystem)?
  2. Is it possible to execute a command (in this case the rm command) with some kind of flag specifying that modified dates are not to be changed during this command)?

Relative date filter views block is cached for anonymous users

Drupal 7.74, views 3.24 (latest)

I have a view which uses a date field to filter and shows on: less than or equal to “now”

I display the view in a block.

With caching for anonymous enabled, (caching blocks disabled), the view block is not shown when the date has passed (works for authenticated users)

Is this normal behaviour, am I missing something, or do I need to disable caching for the pages this block will appear on?

Thanks!

date – MySQL – Query records between yesterday and today but with a specific time

I seem to be having a case of the Fridays. I am new to MySQL (few weeks now) and I just can’t seem to get a report automated. I need to be able to query data from yesterday 8 am until today 8 am. I am going to schedule the report to run at 10 am. What is the best way to do this? I have been running it manually with BETWEEN but this will not do. I tried to use the interval feature but no luck. I think I am almost there.

One try:

purchase_date BETWEEN '2020-11-18 09:00:00' and (DATE(NOW()) - INTERVAL 16 hour)

Another try:

purchase_date BETWEEN BETWEEN (DATE(NOW()) - INTERVAL 40 hour) and (DATE(NOW()) - INTERVAL 16 hour)

If you can just point me to the function or best option in this case, I should be able to figure out the arguments. Ideas/suggestions/thoughts? Thank you!

Donnot show date time value in field system config BE Magento 2

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <tab id="mycustom" translate="label" sortOrder="450">
            <label>My Custom Setting</label>
        </tab>
        <section id="mycustom" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
            <class>separator-top</class>
            <label>My Custom Setting</label>
            <tab>mycustom</tab>
            <resource>Magento_Checkout::config</resource>
            <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <field id="mydate" translate="label" type="date" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>My Date Field</label>
                    <frontend_model>VendorCheckoutBlockAdminhtmlSystemConfigDate</frontend_model>
                </field>
            </group>
        </section>
    </system>
</config>

How to fix it?