我正在尝试将now的日期戳转换为Unix TimeStamp,但是下面的代码似乎被点击但是然后跳转到我的应用程序的末尾,因为似乎不喜欢time.mktime部分.
from datetime import datetime
import time
now = datetime.now()
toDayDate = now.replace(hour=0, minute=0, second=0, microsecond=0)
newDate = time.mktime(datetime.strptime(toDayDate, "%Y-%m-%d %H:%M:%S").timetuple())
print(newDate)
Run Code Online (Sandbox Code Playgroud) 我正在尝试为 Nestjs TypeORM 设置迁移,在我的文件中,TypeOrmModule.forRoot()我已添加了所需的迁移文件夹,但它不断将迁移添加到根文件夹。
TypeOrmModule.forRoot({
type: 'mssql',
host: 'test',
port: 1,
username: 'test',
password: 'test',
database: 'test',
entities: [__dirname + '/**/entities/*{.ts,.js}'],
synchronize: false,
options: {
useUTC: true,
},
migrations: [__dirname + '/**/migration/*.ts'],
cli: {
migrationsDir: __dirname + '/**/migration',
},
})
Run Code Online (Sandbox Code Playgroud) 我尝试创建服务,但是当我尝试添加任何可观察项时,会引发以下错误, Property 'map' is missing in type 'Observable<any[]>'.
以下是我的服务
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from 'environments/environment';
import { Observable } from 'apollo-client/util/Observable';
import { catchError } from 'rxjs/operators';
import { throwError } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class TestService {
protected apiURL = 'http://localhost:3000';
constructor(private http: HttpClient) {}
getTestCount(): Observable<any[]> {
return this.http
.get<any[]>(`${this.apiURL}/test-count`)
.pipe(
catchError(err => {
return throwError(new Error(err));
})
);
}
}
Run Code Online (Sandbox Code Playgroud)