| |

VerySource

 Forgot password?
 Register
Search
View: 675|Reply: 6

I want to read the string of text file date into the database, how to achieve it? Thank you !!!!

[Copy link]

2

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-2-20 19:00:01
| Show all posts |Read mode
a.txt
20161018081240
.....
tb
theDateTime
2016-10-18 08:12

How can it be inserted into the time, the other formats are no problem, and no error is reported after becoming the date, just no data!
Thank you!!
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-4-28 23:30:01
| Show all posts
The stored procedure defines the incoming parameters as DATETIME type, the characters will be converted to DATETIME type by default
Reply

Use magic Report

0

Threads

119

Posts

67.00

Credits

Newbie

Rank: 1

Credits
67.00

 Colombia

Post time: 2020-4-29 06:00:01
| Show all posts
Add the delimiter to the string read from the database (such as 20161018081240), and then you can insert
20161018081240-》 2016-10-18 08:12:40
Reply

Use magic Report

0

Threads

17

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-4-29 08:00:01
| Show all posts
LZ means to put 20161018081240
Is this date and time format written into the database converted to 2016-10-18 08:12:40?
Reply

Use magic Report

0

Threads

7

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-5 10:30:01
| Show all posts
cast ('20161018081240' as datetime) can be used directly in the database. As long as your string is in the correct format
Reply

Use magic Report

2

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-5-9 16:30:01
| Show all posts
bastard
 
 
   LZ means to put 20161018081240
Is this date and time format written in the database on 2016-10-18 08:12:40?


  
 
Yes
Reply

Use magic Report

2

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-5-10 15:30:01
| Show all posts
It turns out that adding-:: would be foolish, just learning .... don't laugh
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list