Z
Z
Zakhar Shaikov2017-12-24 22:49:42
PHP
Zakhar Shaikov, 2017-12-24 22:49:42

Time encoding in CSV file?

Good day! There was a difficulty with determining the type of encoding of the CSV file.
The file contains the exact time and price 5a4004cbd3c2c311932488.pngas I defined in the second column. It remains to find out what the time format is in the first and third columns. Also tell me how to import this format into the database through PHPadmin

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Petr Sleptsov, 2017-12-25
@Singularnost2045

The first column is unixtime (the number of seconds since January 1, 1970) and the second and third fields are floating point numbers.
A table in MySQL is created like this:

CREATE TABLE IF NOT EXISTS `shop` (
`id` int(11) NOT NULL,
  `utime` int(11) NOT NULL,
  `cost` float NOT NULL,
  `wtf` float NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;


ALTER TABLE `shop`
 ADD PRIMARY KEY (`id`);


ALTER TABLE `shop`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;

The import itself goes like this:
5a405d3f0a906763540548.png

A
AVKor, 2017-12-24
@AVKor

This is a Unix timestamp. There is no coding at all.
For loading:

LOAD DATA LOCAL INFILE 'file.csv' INTO TABLE mytable;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question