如何在单个查询中使用sql添加日期,月份和年份 [英] how to add date,month and year using sql in single query

查看:365
本文介绍了如何在单个查询中使用sql添加日期,月份和年份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dateofbirth Textbox1



在textbox1中我有今天日期25/09/2015



来自以上今天我想补充60天。为此我该如何使用sql server。



i想得到如下输出



25 / 11/2015(输出我想得到)。

解决方案

使用SQL 日期添加 [ ^ ] function


使用以下语法

 DATEADD(datepart,number, date 


Dateofbirth Textbox1

In textbox1 i have today'sdate 25/09/2015

from the above todays i want to add 60 days. for that how can i do using sql server.

i want to get the output as follows

25/11/2015 (Output i wan to get).

解决方案

Use the SQL DateAdd[^] function


Use below syntax

DATEADD(datepart,number,date)


这篇关于如何在单个查询中使用sql添加日期,月份和年份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆