Python Pandas: DataFrame converter coluna de Timestamp para DataTime

boa tarde!

Como posso converter uma coluna DataFrama de Timestamp para DataTime?

'
btc_df = pd.DataFrame ( bars_day , columns=('date' , 'volume' , 'open' , 'high' , 'low' , 'close') )

date       int64
volume    object
open      object
high      object
low       object
close     object
dtype: object
                 volume      open  ...
date                               ...                          
1610323200000  38150.02  38264.74  ...
1610409600000  35410.37  36628.00  ...
1610496000000  34049.15  37850.00  ...
1610582400000  37371.38  40100.00  ...
1610668800000  39145.21  39747.76  ...
'

Obrigado,

git – How can I check the timestamp of a remote commit without cloning the repository?

There is a Git sub-command called ls-remote which allows listing of all the branches and commit hashes of the leaf node/tip of each branch.

How can I also query the timestamp of those commits, or other related information of the commit, without cloning the repo locally? (or, is there no way to do this without cloning the repo)

Google Sheets: Lookup Value that falls after a Timestamp

Need serious assistance. Please see images below for a reference.

I have 2 sheets – The second image represents a sheet that is connected to a Google Form. This inputs the site information for various machines. Machines can move between sites on different weeks.

The first image represents a sheet that aggregates various data inputs for daily fuel consumption. The intention here is to have the Site column represent where the machine would have been Located on the date that the timestamp of fuel consumption on this sheet is recorded.

I want to lookup the site location that a machine would have been at if the timestamp that the fuel is recorded falls after a date that the machine location changed. the chalenge here is maintaining historic locations as the sites move around with Google Form entries.

enter image description here

enter image description here

google sheets – Double Timestamp with checkbox

im absolutelly new in programming and I found this solution which helps me stamping the date in a cell depending on a checkbox value. The problem is that I tried to copy the exact same code and changing the column from “C” to “D” and have both working the same way but either works on one or the other.

/**

  • This function is an auto-trigger, because of its name. It will be
  • invoked on every change in the spreadsheet. The only change that
  • we’re interested in is in Column D, and we want to put a timestamp
  • into Column J if the value selected for Column D is “VERDADERO”.
    */
    function onEdit(event){
    var ColD = 4; // Column Number of “D”

var changedRange = event.source.getActiveRange();
if (changedRange.getColumn() == ColD) {
// An edit has occurred in Column D
var state = changedRange.getValue();
var adjacent = event.source.getActiveSheet().getRange(changedRange.getRow(),ColD+6);
var timestamp = new Date(); // Get the current time
// We’ll do something different, depending on the selected value
switch (state) {
case “TRUE”:
case true:
adjacent.setValue(timestamp);
break;
case “FALSE”:
case false:
adjacent.clearContent();
break;
default:
// Something we didn’t expect
adjacent.setValue(“ERROR”);
break
}
}
}

Any ideas?

Please tell me if more information is needed

database design – What value should I choose as length for timestamp without timezone in PostgreSQL?

I’m currently setting up a database to populate it with big data. All the data I get comes from Valve’s Steam Web API. Therefore, as all timestamps are returned in Unix timestamps, I cannot directly derive the correct timezone – which is also not of any interest as it’s to fine-grained for what it is intended for. However, PostgreSQL enables the “length”-value field when setting the column up for timestamp without timezone but I don’t know which value is meaningful to enter here and I also couldn’t find any information about this value – neither in the official documentation nor on StackExchange so far.

As I’m someone who doesn’t set up databases all the time I’m a bit confused and would love to get some assistance. Thanks in advance for your suggestions and input.

java – Sonar marca “Mutable members should not be stored or returned directly” en getters y setters automáticos para Timestamp y List

Como puedo poner los getter y setter para estas opciones TimeStamp y List, para que no me salga este mensaje en sonar.

Mutable members should not be stored or returned directly

Mutable objects are those whose state can be changed. For instance, an array is mutable, but a String is not. Mutable class members should never be returned to a caller or accepted and stored directly. Doing so leaves you vulnerable to unexpected changes in your class state.

/**
     * @return the fecmoc
     */
    public Timestamp getFecmoc() {
        return fecmoc;

}
    /**
     * @param fecmoc the fecmoc to set
     */
    public void setFecmoc(Timestamp fecmoc) {
        this.fecmoc = fecmoc;
}

timestamp – In the time side channel, is there any way to improve the measurement time accuracy?

I want to measure the execution time of a function. The execution time of this function is only slightly different in the two cases. Is there any way I can accurately measure its time to distinguish the two cases?
The possible solutions are:

  1. Use precise measurement functions. Such as __rdtscp or std::chrono clock. I tried __rdtscp, but due to the noise caused by the serializing and the granularity of time stamp counter, __tdtscp is still not accurate enough. Is there any way to reduce the noise during __rdtscp measurement?
  2. Increase the time difference of function execution. This is what I want to do now. But once this function is changed, the background becomes less convincing.
  3. Is there a lot of noise in calling functions? Is there any way to reduce the noise in calling functions? Can calling functions in inline assembly reduce noise? Or is it new to do some other work before calling the function?

Can someone give me some advice?

php – Comparando timestamp de agora com a timestamp de vencimento

O que eu estou tentando fazer é o seguinte, fazer com que a váriavel $timenow compare o tempo de expiração com o resultado que fica no banco de dados $row("exp_time"), e se tiver vencido (ou se não for encontrado nenhum resultado), cair ali no else, o que eu tentei fazer foi colocar o exp_time no banco de dados 0 pra ser menor, e também tentei colocando maior, como por exemplo 99999999, e os 2 estão caindo no else, o certo era só se expirar (ou se não for encontrado nenhum resultado) cair no else, o que pode ser?


<?php 
$stream_id = $_GET('id'); 
$timenow = time();
$time = time() + (1*60*60);
?>


<?php

// GET DATA FROM SQL
require('sql.php');

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname, $db_port);
// Check connection
if (!$conn) {
  die("Connection failed: " . mysqli_connect_error());
}

$sql = "SELECT * FROM `links` WHERE id=$stream_id";
$result = mysqli_query($conn, $sql);



if (mysqli_num_rows($result) > 0 and $timenow < $row("exp_time")) {
 
      // output data of each row
      while($row = mysqli_fetch_assoc($result)) {
        echo "Link ainda funciona.<br>";
        echo " ".$row("id")."<br>";
        echo " ".$row("link")."<br>";
        echo "Tempo agora"; echo time(); echo "<br>";
        echo " ".$row("exp_time")."<br>";
      }
    
    mysqli_close($conn);

} else {
        
        // INSERT INTO TABLE
        $link = "http://teste.com/";

        require('sql.php');

        // Create connection
        $conn = mysqli_connect($servername, $username, $password, $dbname, $db_port);
        // Check connection
        if (!$conn) {
            die("Connection failed: " . mysqli_connect_error());
        }

        $sql = "INSERT INTO links (id, link, exp_time) VALUES ($stream_id, '$link', $time) ON DUPLICATE KEY UPDATE link='$link', exp_time='$time'";

        if (mysqli_query($conn, $sql)) {
            echo "New record created successfully";
        } else {
            echo "Error: " . $sql . "<br>" . mysqli_error($conn);
        }

        mysqli_close($conn);

}
?>

postgresql – operator does not exist: @ timestamp without time zone

In a parameterized query issued from c# code to PostgreSQL 10.14 via dotConnect 7.7.832 .NET connector, I select either a parameter value or the local timestamp, if the parameter is NULL:

using (var cmd = new PgSqlCommand("select COALESCE(@eventTime, LOCALTIMESTAMP)", connection)

When executed, this statement throws the error in subject. If I comment out the corresponding parameter

cmd.Parameters.Add("@eventTime", PgSqlType.TimeStamp).Value = DateTime.Now;

and hardcode

using (var cmd = new PgSqlCommand("select COALESCE('11/6/2020 2:36:58 PM', LOCALTIMESTAMP)", connection)

or if I cast the parameter

using (var cmd = new PgSqlCommand("select COALESCE(cast(@eventTime as timestamp without time zone), LOCALTIMESTAMP)", connection)

then it works. Can anyone explain what @ operator in the error is referring to and why the error?

android – obtengo fecha extraña de java SimpleDateFormat con un timestamp negativo de firebase para ordenar descendentemente

Solo quiero ordenar mis registros en orden descendente. Estoy usando el método ʻorderByChild () de DatabaseReference`:

private void listPersons() {

        databaseReference.child("Persons").orderByChild("timeStamp").addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                listPersonas.clear();
                for (DataSnapshot objSnaptshot : dataSnapshot.getChildren()){
                    Persona p = objSnaptshot.getValue(Person.class);
                    listPersons.add(p);
                }
    ....
        });
    }

Aquí están mis personas sin una marca de tiempo negativa:

2019/05/31 03:13:22 timestamp: ->1559333602000
2020/09/10 02:50:52 timestamp: ->1599767452000
2020/10/31 02:15:34 timestamp: ->1604171734423

No hay problemas antes de agregar el símbolo negativo, pero cuando pongo el símbolo negativo para usar ʻorderByChild ()` el siguiente método que uso para convertir el timestamp long me devuelve una fecha con años del siglo 19/20.

public String timeStampToDate(Object timestamp){

    String date = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss").format(timestamp);

    return date;
}

Obtuve

2019/05/31 03:13:22 timestamp: -> -1559333602000
2020/09/10 02:50:52 timestamp: -> -1599767452000
2020/10/31 02:15:34 timestamp: -> -1604171734423

1919/03/02 11:44:25
1919/04/22 11:09:08
1920/08/02 10:46:38

introducir la descripción de la imagen aquí

No sé por qué mis fechas son incorrectas, solo puse el símbolo negativo con el objetivo de poner mis registros en orden descendente. El método public String timeStampToDate está dentro de mi clase modelo Person Estoy usando este método dentro de mi listview adapter:

regdate.setText(personModel.timeStampToDate(personModel.getTimeStamp()));

De esta manera estoy registrando mis personas:

 Person p = new Person();
                p.setIdperson(UUID.randomUUID().toString());
                p.setName(name);
                p.setPhone(phone);
                p.setTimeStamp(ServerValue.TIMESTAMP);

                databaseReference.child("Persons").child(p.getIdperson()).setValue(p);

Como podemos ver, estoy usando ServerValue.TIMESTAMP para obtener una marca de tiempo de Firebase. Ahora debería registrar mi marca de tiempo multiplicando por -1. bien. Espero haber sido claro con mi problema.
gracias por adelantado.