• 关于

    _datetime

    的搜索结果

回答

Python的 datetime 模块中有工具函数和类可以帮助你执行这样的计算。 下面是对类似这样的问题的一个通用解决方案: #!/usr/bin/env python # -*- encoding: utf-8 -*- """ Topic: 最后的周五 Desc : """ from datetime import datetime, timedelta weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] def get_previous_byday(dayname, start_date=None): if start_date is None: start_date = datetime.today() day_num = start_date.weekday() day_num_target = weekdays.index(dayname) days_ago = (7 + day_num - day_num_target) % 7 if days_ago == 0: days_ago = 7 target_date = start_date - timedelta(days=days_ago) return target_date 在交互式解释器中使用如下: >>> datetime.today() # For reference datetime.datetime(2012, 8, 28, 22, 4, 30, 263076) >>> get_previous_byday('Monday') datetime.datetime(2012, 8, 27, 22, 3, 57, 29045) >>> get_previous_byday('Tuesday') # Previous week, not today datetime.datetime(2012, 8, 21, 22, 4, 12, 629771) >>> get_previous_byday('Friday') datetime.datetime(2012, 8, 24, 22, 5, 9, 911393) >>> 可选的 start_date 参数可以由另外一个 datetime 实例来提供。比如: >>> get_previous_byday('Sunday', datetime(2012, 12, 21)) datetime.datetime(2012, 12, 16, 0, 0) >>>

哦哦喔 2020-04-16 21:16:44 0 浏览量 回答数 0

问题

全局事务服务 GTS 函数怎么运行?

猫饭先生 2019-12-01 21:25:08 991 浏览量 回答数 0

回答

没有必要重复每个日期。看到这个实现: #!pip install pandas_market_calendars import pandas_market_calendars as mcal import numpy as np import pandas as pd import datetime def next_trading_day(start_day=None, num_trading_days=7, direction=1, SAFE_DELTA = 100, as_string=True): """Returns the next/previous trading date separated by a certain number of trading days. This function returns the next/previous trading day. The parameter num_trading_days determines how many days back or into the future, direction determines whether backward (-1) or forward (1). Parameters ---------- start_day: datetime.date or a str object. (default is today's UTC date). Date of starting day. num_trading_days: int. (default is 7) direction: int. (default is 1 (forward)) Use 1 for forward/future and -1 for backward/past. as_string: bool (default is True) This controls the data type of the returned value of next_day. Returns the next_day as a string if True, else as a datetime.date object. SAFE_DELTA: int. (default is 100) SAFE_DELTA = 100 adds 100 additional days to extend the range of dates and then finds which dates are valid trading dates. Returns ------- next_day: str or datetime.date object. valid_trading_days: pandas.Series object of datetime.date objects. """ if start_day is None: start_day = datetime.datetime.utcnow().date() start = pd.to_datetime(start_day) end = start + np.timedelta64(num_trading_days+SAFE_DELTA, 'D')*direction business_days = mcal.get_calendar('NYSE').valid_days(start_date=start, end_date=end) valid_trading_days = pd.DataFrame(business_days[:num_trading_days], columns=['DT']).DT.dt.date next_day = business_days[num_trading_days].date() if as_string: next_day = next_day.strftime("%Y-%m-%d") # if the series of trading days from start_day to next_day are not required, # then use: # >>> valid_trading_days = None # You may also comment out the valid_trading_days variable creation line above. # And change the function-output accordingly. return (next_day, valid_trading_days) start_day='2019-12-18' # (Wednesday) num_trading_days = 7 next_day, valid_trading_days = next_trading_day(start_day = start_day, num_trading_days = num_trading_days, direction = 1, SAFE_DELTA = 100) print('next_day: {} (after {} trading days)\n'.format(next_day, num_trading_days)) print('valid_trading_days: \n\n{}'.format(valid_trading_days)) 输出: next_day: 2019-12-30 (after 7 trading days) valid_trading_days: 0 2019-12-18 1 2019-12-19 2 2019-12-20 3 2019-12-23 4 2019-12-24 5 2019-12-26 6 2019-12-27 Name: DT, dtype: object

kun坤 2019-12-25 21:40:15 0 浏览量 回答数 0

阿里云高校特惠,助力学生创业梦!0元体验,快速入门云计算!

学生动手场景应用,快速了解并掌握云服务器的各种新奇玩法!

回答

import logging import sys import random import time import datetime class TEST: def prtn_info(self, msg): print(str(datetime.datetime.now()) + msg) #datetime.datetime.now():獲取當前datetime def prtn_global_config(self): self.prtn_info('In prtn_global_config') t = TEST() t.prtn_global_config()

几许相思几点泪 2019-12-29 18:46:29 0 浏览量 回答数 0

问题

超过了锁定等待超时;尝试重新启动事务-插入语句

几许相思几点泪 2019-12-29 19:45:01 0 浏览量 回答数 0

回答

好问题。日期逻辑可能很难实现,因为可能有许多异常使逻辑复杂化。Python有一个名为datetime的模块,该模块使此过程更容易,因为其他人已经实现了一个月,一年和潜在leap年中有多少天。 使用datetime,您可以轻松获得一天 import datetime a_week_ago = datetime.datetime.now() - datetime.timedelta(days=7) 现在,您需要将date对象转换为适合您文件结构的字符串。这里有很多选择,这是一个建议: import datetime new_date = datetime.datetime.now() - datetime.timedelta(days=7) prefix = r"C:\\Users\\my_files\\" new = prefix + new_date.strftime(r"%Y\\%m\\%d\\") print(new) 然后,您可以将其放入一个循环并修改日期,使其不是7,而是向后循环。 import datetime number_of_days = 7 file_path = Path('C:\\Users\\my_files') for i in range(number_of_days): new_date = datetime.datetime.now() - datetime.timedelta(days=i) year = new_date.strftime("%Y") month = new_date.strftime("%m") day = new_date.strftime("%d") file_path = os.path.join( year, month, day) print(file_path) 您可以使用指南从此处了解如何使用strtime格式化日期,以获取适当的字符串。 回答来源:stackoverflow

is大龙 2020-03-23 17:52:59 0 浏览量 回答数 0

问题

問題關於 NameError: name 'self' is not defined

几许相思几点泪 2019-12-29 18:46:12 0 浏览量 回答数 1

回答

import datetime class TimeException(Exception): def __init__(self, exception_info): super().__init__() self.info = exception_info def __str__(self): return self.info def timecheck(func): def wrapper(*args, **kwargs): if datetime.datetime.now().year == 2019: func(*args, **kwargs) else: raise TimeException("函数已过时") return wrapper @timecheck def test(name): print("Hello {}, 2019 Happy".format(name)) if __name__ == "__main__": test("backbp")

珍宝珠 2019-12-02 03:12:48 0 浏览量 回答数 0

问题

将数据集中的列类型转换为python中具有特定格式的datetime类型时出错

一码平川MACHEL 2019-12-01 19:32:10 679 浏览量 回答数 1

回答

在这样的日期上循环并需要事先构造一个包含所有日期的列表。 你可以先计算出开始日期和结束日期, 然后在你步进的时候使用 datetime.timedelta 对象递增这个日期变量即可。 下面是一个接受任意 datetime 对象并返回一个由当前月份开始日和下个月开始日组成的元组对象。 from datetime import datetime, date, timedelta import calendar def get_month_range(start_date=None): if start_date is None: start_date = date.today().replace(day=1) _, days_in_month = calendar.monthrange(start_date.year, start_date.month) end_date = start_date + timedelta(days=days_in_month) return (start_date, end_date) 有了这个就可以很容易的在返回的日期范围上面做循环操作了: >>> a_day = timedelta(days=1) >>> first_day, last_day = get_month_range() >>> while first_day < last_day: ... print(first_day) ... first_day += a_day ... 2012-08-01 2012-08-02 2012-08-03 2012-08-04 2012-08-05 2012-08-06 2012-08-07 2012-08-08 2012-08-09 #... and so on...

哦哦喔 2020-04-16 21:17:24 0 浏览量 回答数 0

回答

#define FM_LOG_DEBUG(x...) log_write(LOG_DEBUG, __FILE__, __LINE__, ##x) static void log_write(int level, const char *file, const int line, const char *fmt, ...) { if (log_opened == 0) { fprintf(stderr, "log_open not called yet\n"); exit(1); } static char buffer[log_buffer_size]; static char datetime[100]; static char line_str[20]; static time_t now; now = time(NULL); strftime(datetime, 99, "%Y-%m-%d %H:%M:%S", localtime(&now)); snprintf(line_str, 19, "%d", line); va_list ap; va_start(ap, fmt); vsnprintf(log_buffer, log_buffer_size, fmt, ap); va_end(ap); size_t count = snprintf(buffer, log_buffer_size, "%s\x7 [%s]\x7 [%s:%d]%s\x7 %s\x7\n", LOG_LEVEL_NOTE[level], datetime, file, line, log_extra_info, log_buffer); int log_fd = log_fp->_fileno; //puts(buffer); if (flock(log_fd, LOCK_EX) == 0) { if (write(log_fd, buffer, count) < 0) { perror("write error"); exit(1); } flock(log_fd, LOCK_UN); } else { perror("flock error"); exit(1); } }

a123456678 2019-12-02 02:34:53 0 浏览量 回答数 0

回答

from datetime import datetime data_set_x = [[2, 13, '2019-02-02T07:00:00'], [7, 8, '2019-02-02T09:00:00']] def convert_date(s): date_object = datetime.strptime(s, '%Y-%m-%dT%H:%M:%S') return date_object.strftime('%Y-%m-%d'), date_object.strftime('%H:%M') for idx,item in enumerate(data_set_x): data_set_x[idx][-1], time = convert_date(item[2]) data_set_x[idx].append(time) for i in data_set_x: sql = "insert into data (ValueA, ValueB, Date, Time) values (%s, %s, %s, %s)" print(sql, i)

一码平川MACHEL 2019-12-02 01:54:23 0 浏览量 回答数 0

回答

你可以让你的默认输入远离日期,考虑一下: import datetime x = ['2000-01-01', '2001-01-01', '2002-01-01']datefmt = "%Y-%m-%d" # The dateformat used to parse the dates This code can live for 180+ years, YAY! (2019-02-26) def filter_str(x, lower_bound='1900-01-01', upper_bound='2199-12-31'): lb = datetime.datetime.strptime(lower_bound, datefmt) ub = datetime.datetime.strptime(upper_bound, datefmt) return [y for y in x if lb < datetime.datetime.strptime(y, datefmt) < ub] out = filter_str(x, lower_bound='2000-02-01', upper_bound='2003-01-01')print(out)返回: ['2001-01-01', '2002-01-01']

一码平川MACHEL 2019-12-02 01:57:36 0 浏览量 回答数 0

问题

在创建CSV之前,panda会转换Epoch时间

kun坤 2019-12-30 09:59:23 1 浏览量 回答数 0

回答

您似乎正在尝试从Hive表中读取pandas数据帧并进行一些转换并将其保存回某些Hive外部表。请参考以下代码作为样本。在这里,我从Hive表中读到了pandas数据帧,并为其添加了一些日期列。后来我使用了子进程模块来执行我的shell,它将数据加载到Hive表中,该表在某个日期列上进行了分区。 from pyhive import hive import pandas as pd import sqlalchemy from sqlalchemy.engine import create_engine import datetime from subprocess import PIPE, Popen import subprocess import sys conn = hive.Connection(host="yourhost.com", port=10000, username="vikct001") cursor = conn.cursor() query="select user_id,country from test_dev_db.test_data" start_time= datetime.datetime.now() output_file='/home/vikct001/user/vikrant/python/test_data.csv' data=pd.read_sql(query,conn) data['current_date'] = pd.datetime.today().strftime("%Y-%m-%d") print(data) data.to_csv(output_file, sep='|', encoding='utf-8',index=None) hivequery=""" hive --hivevar loaded_date=$(date +"%Y-%m-%d") hive -e 'LOAD DATA LOCAL INPATH "/home/vikct001/user/vikrant/python/test_data.csv" INTO TABLE test_dev_db.test_data_external PARTITION (loaded_date="${hivevar:loaded_date}")';""" def save_to_hdfs(output_file): print("I am here") p=subprocess.Popen(hivequery,shell=True,stderr=subprocess.PIPE) stdout,stderr = p.communicate() if p.returncode != 0: print stderr sys.exit(1) save_to_hdfs(output_file) end_time=datetime.datetime.now() print 'processing ends', (start_time-end_time).seconds/60.0,' minutes'

游客gsy3rkgcdl27k 2019-12-02 02:11:02 0 浏览量 回答数 0

回答

import scipy.io as scioimport osimport ctypesimport datetimeimport numpy as np 读取dll文件 这里的地址目录是HessianFilter.dll所在的文件夹 start = datetime.datetime.now()cur_path = os.path.dirname(r'C:UsersAdministratorDesktopcode_and_datacodeHessianFilter')dll_path = os.path.join(cur_path,'HessianFilter.dll')print dll_path dll = ctypes.windll.LoadLibrary(dll_path) 读取mat文件,Mat文件所在的文件夹中读取 matPath = r'C:UsersAdministratorDesktopcode_and_datadataNodule19664.mat'imgData = scio.loadmat(matPath) 从mat文件中我们取到了整个三维数组 imgDataArray = imgData['imagetest1'] 得到数组文件的参数:宽,高,层数 widthSrc,heightSrc,sliceNumSrc = imgDataArray.shape 声明一个三维的c_float类型的数组,用于存放mat数据,并将数据转化为c_float imgDataArray_p = (((ctypes.c_floatsliceNumSrc)heightSrc)*widthSrc)() for i in range(widthSrc):for j in range(heightSrc):for k in range(sliceNumSrc):imgDataArray_pi[k] = ctypes.c_float(imgDataArrayi[k]) imgDataP = ctypes.POINTER(ctypes.c_float)(imgDataArray_p)print '---------->' 需要再声明两个返回值 HessianDot = (ctypes.c_float(widthSrcheightSrc*sliceNumSrc))()HessianLine = (ctypes.c_float(widthSrcheightSrc*sliceNumSrc))() HessianDot_p = ctypes.POINTER(ctypes.c_float)(HessianDot)HessianLine_p = ctypes.POINTER(ctypes.c_float)(HessianLine) 定义一个常数 sigma = ctypes.c_float(8) 定义一个三维数组 imgSize = [widthSrc,heightSrc,sliceNumSrc]imageSize = (ctypes.c_floatlen(imgSize))(imgSize) 定义一个指向三维数组的指针 imageSizeP = ctypes.POINTER(ctypes.c_float)(imageSize) 这个就是调用dll中的函数了 dll.RunHessianMultiThread(ctypes.byref(imgDataArray_p),sigma,ctypes.byref(imageSizeP),ctypes.byref(HessianDot_p),ctypes.byref(HessianLine_p),4)print '--调用后-点数据--'print HessianDot_pprint HessianDot_p[0:24] print HessianDot_p.contents print '--调用后-线数据--'print HessianLine_pprint HessianLine_p[0:24] print HessianLine_p.contents print '<---------Over------------->nn'print datetime.datetime.now()-start

小六码奴 2019-12-02 00:16:46 0 浏览量 回答数 0

问题

python调用dll怎么返回多个值

小云葩 2019-12-01 20:25:45 2274 浏览量 回答数 1

回答

您可以这样做: from datetime import datetime, timedelta # Fetch today's date date = datetime.today() string_date = date.strftime('%Y-%m-%d-%H.%M.%S') # Variable for log file log_file = os.getcwd() print(log_file) os.mkdir("Logs12") f = open(f"Password_Expiry_Date_Log_{string_date}.txt", "w+") f.close() #Date Calculations date_before = datetime.today() - timedelta(days=1) days_after = datetime.today() + timedelta(days=1) 我还更新了您的字符串名称以符合PEP8 编辑:我还改善了您的语法,请记住,您始终需要关闭文件。 回答来源:stackoverflow

is大龙 2020-03-24 08:56:28 0 浏览量 回答数 0

回答

尝试解析字符串日期,然后使用withColumn并在每行上应用并获取解析后的新日期列。您应该将您的函数定义为udf之前使用它。 import datetime def date_time_to_date(input_date_time): new_date = datetime.datetime.strptime(input_date_time, "%d-%M-%Y").date() return str(new_date.month) + "/"+ str(new_date.year) udf_date_time_to_date = udf(date_time_to_date, StringType())data.toDF(['id' , 'date']).withColumn('new_date', udf_date_time_to_date('date')) 您应该将文件读作csv而不是文本。我只是在Scala中使用硬编码的df来模仿它。您应该能够使用类似的语法将其转换为python。 val df = Seq((1,"01-01-2001"),(2,"01-02-2001"),(3,"01-03-2001")).toDF("a","b")val df2 = df.withColumn("b",to_date('b,"dd-MM-yyy"))df2.printSchema()df2.show(false)df2.select(col("a"), date_format('b,"MM/yyyy").as("dt1")).show(false)结果: root |-- a: integer (nullable = false) |-- b: date (nullable = true) a b 1 2001-01-01 2 2001-02-01 3 2001-03-01 a dt1 1 01/2001 2 02/2001 3 03/2001

社区小助手 2019-12-02 01:51:20 0 浏览量 回答数 0

回答

新版WordPress就是用了utf8mb4编码:/* 数据库 */ CREATE DATABASE IF NOT EXISTS `wordpress` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; /* 评论表 */ CREATE TABLE IF NOT EXISTS `wp_comments` ( `comment_ID` bigint(20) unsigned NOT NULL, `comment_post_ID` bigint(20) unsigned NOT NULL DEFAULT '0', `comment_author` text COLLATE utf8mb4_unicode_ci NOT NULL, `comment_author_email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `comment_author_url` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `comment_author_IP` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `comment_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `comment_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `comment_content` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `comment_karma` int(11) NOT NULL DEFAULT '0', `comment_approved` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '1', `comment_agent` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `comment_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `comment_parent` bigint(20) unsigned NOT NULL DEFAULT '0', `user_id` bigint(20) unsigned NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_un

小旋风柴进 2019-12-02 02:05:40 0 浏览量 回答数 0

问题

mysql 自定义函数一直报错语法有问题,找不哪里错了,求大神帮忙 ?报错

爱吃鱼的程序员 2020-06-22 23:57:24 0 浏览量 回答数 1

问题

从列表中的datetime元素中分隔日期和时间

一码平川MACHEL 2019-12-01 19:32:11 561 浏览量 回答数 1

问题

在python中使用django-celery时如何将登录用户详细信息调用到task.py中

几许相思几点泪 2019-12-24 20:44:21 0 浏览量 回答数 0

问题

为什么建立数据库表中有一对一的关系?

落地花开啦 2019-12-01 19:47:51 3544 浏览量 回答数 1

问题

将datetime。pandas.core.series日期。系列在Python中?

kun坤 2019-12-28 14:14:12 0 浏览量 回答数 1

问题

使用datetime.datetime对象作为键向csv编写字典

is大龙 2020-03-24 20:26:39 0 浏览量 回答数 1

问题

我正在使用python客户端为kubernetes编写python脚本

kun坤 2019-12-25 22:14:47 3 浏览量 回答数 1

回答

你是怎么转的?###### 本身没有转换。   DbCommand _dbcomm = DB.GetStoredProcCommand("p_au_I_biddinginfo"); DB.AddInParameter(_dbcomm, "@ID", DbType.Int32, _biddinginfo.ID); DB.AddInParameter(_dbcomm, "@Address", DbType.String, _biddinginfo.Address); DB.AddInParameter(_dbcomm, "@Area", DbType.Decimal, _biddinginfo.Area); DB.AddInParameter(_dbcomm, "@Areaid", DbType.Int32, _biddinginfo.Areaid); DB.AddInParameter(_dbcomm, "@Border", DbType.Int32, _biddinginfo.Border); DB.AddInParameter(_dbcomm, "@Cellid", DbType.Int32, _biddinginfo.Cellid); DB.AddInParameter(_dbcomm, "@Cellname", DbType.String, _biddinginfo.Cellname); DB.AddInParameter(_dbcomm, "@Checkstate", DbType.Boolean, _biddinginfo.Checkstate); DB.AddInParameter(_dbcomm, "@Cmessage", DbType.String, _biddinginfo.Cmessage); DB.AddInParameter(_dbcomm, "@Cqq", DbType.String, _biddinginfo.Cqq); DB.AddInParameter(_dbcomm, "@Cuser", DbType.String, _biddinginfo.Cuser); DB.AddInParameter(_dbcomm, "@Ddate", DbType.DateTime, _biddinginfo.Ddate); DB.AddInParameter(_dbcomm, "@description", DbType.String, _biddinginfo.description); DB.AddInParameter(_dbcomm, "@Edatetime", DbType.DateTime, _biddinginfo.Edatetime); DB.AddInParameter(_dbcomm, "@Email", DbType.String, _biddinginfo.Email); DB.AddInParameter(_dbcomm, "@Marker", DbType.String, _biddinginfo.Marker); DB.AddInParameter(_dbcomm, "@Mobile", DbType.String, _biddinginfo.Mobile); DB.AddInParameter(_dbcomm, "@Pdate", DbType.DateTime, _biddinginfo.Pdate); DB.AddInParameter(_dbcomm, "@Pid", DbType.Int32, _biddinginfo.Pid); DB.AddInParameter(_dbcomm, "@Pirce", DbType.Decimal, _biddinginfo.Pirce); DB.AddInParameter(_dbcomm, "@S", DbType.Int32, _biddinginfo.S); DB.AddInParameter(_dbcomm, "@State", DbType.Boolean, _biddinginfo.State); DB.AddInParameter(_dbcomm, "@Styleid", DbType.Int32, _biddinginfo.Styleid); DB.AddInParameter(_dbcomm, "@T", DbType.Int32, _biddinginfo.T); DB.AddInParameter(_dbcomm, "@Type", DbType.Int32, _biddinginfo.Type); DB.AddInParameter(_dbcomm, "@W", DbType.Int32, _biddinginfo.W); // DB.AddInParameter(_dbcomm, "@NumberID", DbType.String, DateTime.Now.ToString("yyyyMMddHHmmssffff")); ######肯定要做转换的啊,varchar 要先转成 number######我不明白你的意思。我是插入操作。什么地方需要转换?

优选2 2020-06-05 13:37:33 0 浏览量 回答数 0

回答

你是怎么转的?###### 本身没有转换。   DbCommand _dbcomm = DB.GetStoredProcCommand("p_au_I_biddinginfo"); DB.AddInParameter(_dbcomm, "@ID", DbType.Int32, _biddinginfo.ID); DB.AddInParameter(_dbcomm, "@Address", DbType.String, _biddinginfo.Address); DB.AddInParameter(_dbcomm, "@Area", DbType.Decimal, _biddinginfo.Area); DB.AddInParameter(_dbcomm, "@Areaid", DbType.Int32, _biddinginfo.Areaid); DB.AddInParameter(_dbcomm, "@Border", DbType.Int32, _biddinginfo.Border); DB.AddInParameter(_dbcomm, "@Cellid", DbType.Int32, _biddinginfo.Cellid); DB.AddInParameter(_dbcomm, "@Cellname", DbType.String, _biddinginfo.Cellname); DB.AddInParameter(_dbcomm, "@Checkstate", DbType.Boolean, _biddinginfo.Checkstate); DB.AddInParameter(_dbcomm, "@Cmessage", DbType.String, _biddinginfo.Cmessage); DB.AddInParameter(_dbcomm, "@Cqq", DbType.String, _biddinginfo.Cqq); DB.AddInParameter(_dbcomm, "@Cuser", DbType.String, _biddinginfo.Cuser); DB.AddInParameter(_dbcomm, "@Ddate", DbType.DateTime, _biddinginfo.Ddate); DB.AddInParameter(_dbcomm, "@description", DbType.String, _biddinginfo.description); DB.AddInParameter(_dbcomm, "@Edatetime", DbType.DateTime, _biddinginfo.Edatetime); DB.AddInParameter(_dbcomm, "@Email", DbType.String, _biddinginfo.Email); DB.AddInParameter(_dbcomm, "@Marker", DbType.String, _biddinginfo.Marker); DB.AddInParameter(_dbcomm, "@Mobile", DbType.String, _biddinginfo.Mobile); DB.AddInParameter(_dbcomm, "@Pdate", DbType.DateTime, _biddinginfo.Pdate); DB.AddInParameter(_dbcomm, "@Pid", DbType.Int32, _biddinginfo.Pid); DB.AddInParameter(_dbcomm, "@Pirce", DbType.Decimal, _biddinginfo.Pirce); DB.AddInParameter(_dbcomm, "@S", DbType.Int32, _biddinginfo.S); DB.AddInParameter(_dbcomm, "@State", DbType.Boolean, _biddinginfo.State); DB.AddInParameter(_dbcomm, "@Styleid", DbType.Int32, _biddinginfo.Styleid); DB.AddInParameter(_dbcomm, "@T", DbType.Int32, _biddinginfo.T); DB.AddInParameter(_dbcomm, "@Type", DbType.Int32, _biddinginfo.Type); DB.AddInParameter(_dbcomm, "@W", DbType.Int32, _biddinginfo.W); // DB.AddInParameter(_dbcomm, "@NumberID", DbType.String, DateTime.Now.ToString("yyyyMMddHHmmssffff")); ######肯定要做转换的啊,varchar 要先转成 number######我不明白你的意思。我是插入操作。什么地方需要转换?

爱吃鱼的程序员 2020-06-02 11:48:46 0 浏览量 回答数 0

回答

你是怎么转的?###### 本身没有转换。   DbCommand _dbcomm = DB.GetStoredProcCommand("p_au_I_biddinginfo"); DB.AddInParameter(_dbcomm, "@ID", DbType.Int32, _biddinginfo.ID); DB.AddInParameter(_dbcomm, "@Address", DbType.String, _biddinginfo.Address); DB.AddInParameter(_dbcomm, "@Area", DbType.Decimal, _biddinginfo.Area); DB.AddInParameter(_dbcomm, "@Areaid", DbType.Int32, _biddinginfo.Areaid); DB.AddInParameter(_dbcomm, "@Border", DbType.Int32, _biddinginfo.Border); DB.AddInParameter(_dbcomm, "@Cellid", DbType.Int32, _biddinginfo.Cellid); DB.AddInParameter(_dbcomm, "@Cellname", DbType.String, _biddinginfo.Cellname); DB.AddInParameter(_dbcomm, "@Checkstate", DbType.Boolean, _biddinginfo.Checkstate); DB.AddInParameter(_dbcomm, "@Cmessage", DbType.String, _biddinginfo.Cmessage); DB.AddInParameter(_dbcomm, "@Cqq", DbType.String, _biddinginfo.Cqq); DB.AddInParameter(_dbcomm, "@Cuser", DbType.String, _biddinginfo.Cuser); DB.AddInParameter(_dbcomm, "@Ddate", DbType.DateTime, _biddinginfo.Ddate); DB.AddInParameter(_dbcomm, "@description", DbType.String, _biddinginfo.description); DB.AddInParameter(_dbcomm, "@Edatetime", DbType.DateTime, _biddinginfo.Edatetime); DB.AddInParameter(_dbcomm, "@Email", DbType.String, _biddinginfo.Email); DB.AddInParameter(_dbcomm, "@Marker", DbType.String, _biddinginfo.Marker); DB.AddInParameter(_dbcomm, "@Mobile", DbType.String, _biddinginfo.Mobile); DB.AddInParameter(_dbcomm, "@Pdate", DbType.DateTime, _biddinginfo.Pdate); DB.AddInParameter(_dbcomm, "@Pid", DbType.Int32, _biddinginfo.Pid); DB.AddInParameter(_dbcomm, "@Pirce", DbType.Decimal, _biddinginfo.Pirce); DB.AddInParameter(_dbcomm, "@S", DbType.Int32, _biddinginfo.S); DB.AddInParameter(_dbcomm, "@State", DbType.Boolean, _biddinginfo.State); DB.AddInParameter(_dbcomm, "@Styleid", DbType.Int32, _biddinginfo.Styleid); DB.AddInParameter(_dbcomm, "@T", DbType.Int32, _biddinginfo.T); DB.AddInParameter(_dbcomm, "@Type", DbType.Int32, _biddinginfo.Type); DB.AddInParameter(_dbcomm, "@W", DbType.Int32, _biddinginfo.W); // DB.AddInParameter(_dbcomm, "@NumberID", DbType.String, DateTime.Now.ToString("yyyyMMddHHmmssffff")); ######肯定要做转换的啊,varchar 要先转成 number######我不明白你的意思。我是插入操作。什么地方需要转换?

爱吃鱼的程序员 2020-05-29 17:43:11 0 浏览量 回答数 0
阿里云大学 云服务器ECS com域名 网站域名whois查询 开发者平台 小程序定制 小程序开发 国内短信套餐包 开发者技术与产品 云数据库 图像识别 开发者问答 阿里云建站 阿里云备案 云市场 万网 阿里云帮助文档 免费套餐 开发者工具 企业信息查询 小程序开发制作 视频内容分析 企业网站制作 视频集锦 代理记账服务 2020阿里巴巴研发效能峰会 企业建站模板 云效成长地图 高端建站