当前位置: 首页 > news >正文

房地产公司网站制作百度指数关键词未收录怎么办

房地产公司网站制作,百度指数关键词未收录怎么办,长寿做网站的电话,中国水土保持生态环境建设网站目录 一、基本方法 1.用 DateAndTime.DateAdd方法添加一段时间间隔 2.用DateTime.Add方法添加一段时间间隔 二、实例 1.实例1:用 DateAndTime.DateAdd方法 2.实例2:用DateTime.Add方法 一、基本方法 1.用 DateAndTime.DateAdd方法添加一段时间间隔…

目录

一、基本方法

1.用 DateAndTime.DateAdd方法添加一段时间间隔

2.用DateTime.Add方法添加一段时间间隔

二、实例

1.实例1:用 DateAndTime.DateAdd方法

2.实例2:用DateTime.Add方法


一、基本方法

1.用 DateAndTime.DateAdd方法添加一段时间间隔

        用了DateAndTime类的DateAdd静态方法。

        返回一个 Date 值,其中包含已添加指定时间间隔的日期和时间值。

        使用DateAndTime类的DateAdd静态方法可以方便地向指定日期添加一段时间间隔。语法格式如下:

DateAndTime.DateAdd(Datelnterval interval,double Number,DateTime DateValue);参数说明
interval:表示添加时间间隔的枚举值。
Number:表示要添加的时间间隔数,如果interval的枚举值为day,Number值为1,则向当前时间对象添加1天。
DateValue:表示当前操作的时间对象。

2.用DateTime.Add方法添加一段时间间隔

        使用DateTime的Add方法也可以向指定日期添加一段时间间隔。

        DateTime.Add方法接收一个TimeSpan对象作为参数,用于向当前DateTime中添加一段时间间隔。所以也可以使用DateTime的Add方法代替DateAdd方法实现相同的添加时间间隔的效果。

        返回一个新的 DateTime,它将指定 TimeSpan 的值添加到此实例的值上。

public DateTime Add (TimeSpan value);参数
value    TimeSpan
正或负时间间隔。返回
DateTime
一个对象,其值是此实例所表示的日期和时间与 value 所表示的时间间隔之和。例外
ArgumentOutOfRangeException
生成的 DateTime 小于 DateTime.MinValue 或大于 DateTime.MaxValue。注解
可以使用 Add 方法在单个操作中添加多种类型的时间间隔, (天、小时、分钟、秒或毫秒) 。 此方法的行为与加法运算符的行为相同。 结构 DateTime 还支持每个时间间隔的专用加法 (如 AddDays、 AddHours和 AddMinutes) 。执行日期算术时, Add 方法会考虑闰年和一个月中的天数。此方法不会更改此 DateTime的值。 相反,它返回一个新的 DateTime ,其值是此操作的结果。 新DateTime实例的 属性与当前实例的 属性相同。

二、实例

1.实例1:用 DateAndTime.DateAdd方法

// 用 DateAndTime.DateAdd方法添加一段时间间隔
using Microsoft.VisualBasic;namespace _063
{public partial class Form1 : Form{private GroupBox? groupBox1;private Button? button3;private Button? button2;private Button? button1;private Label? label1;private Button? button4;public DateTime datetime;//定义时间字段public Form1(){InitializeComponent();Load += Form1_Load;}private void Form1_Load(object? sender, EventArgs e){// // label1// label1 = new Label{AutoSize = true,Location = new Point(6, 28),Name = "label1",Size = new Size(44, 17),TabIndex = 0,Text = "时间:"};// // button1// button1 = new Button{Location = new Point(6, 133),Name = "button1",Size = new Size(75, 23),TabIndex = 1,Text = "加1分钟",UseVisualStyleBackColor = true};button1.Click += Button1_Click;// // button2// button2 = new Button{Location = new Point(98, 133),Name = "button2",Size = new Size(75, 23),TabIndex = 2,Text = "加1小时",UseVisualStyleBackColor = true};button2.Click += Button2_Click;// // button3// button3 = new Button{Location = new Point(190, 133),Name = "button3",Size = new Size(75, 23),TabIndex = 3,Text = "加1天",UseVisualStyleBackColor = true};button3.Click += Button3_Click;// // button4// button4 = new Button{Location = new Point(282, 133),Name = "button4",Size = new Size(75, 23),TabIndex = 4,Text = "减1天",UseVisualStyleBackColor = true};button4.Click += Button4_Click;// // groupBox1// groupBox1 = new GroupBox{Location = new Point(12, 12),Name = "groupBox1",Size = new Size(365, 162),TabIndex = 0,TabStop = false,Text = "添加时间间隔"};groupBox1.Controls.Add(button4);groupBox1.Controls.Add(button3);groupBox1.Controls.Add(button2);groupBox1.Controls.Add(button1);groupBox1.Controls.Add(label1);groupBox1.SuspendLayout();// // Form1// AutoScaleDimensions = new SizeF(7F, 17F);AutoScaleMode = AutoScaleMode.Font;ClientSize = new Size(389, 186);Controls.Add(groupBox1);Name = "Form1";StartPosition = FormStartPosition.CenterScreen;Text = "向指定日期添加一段时间间隔";groupBox1.ResumeLayout(false);groupBox1.PerformLayout();datetime = DateTime.Now;//得到系统当前时间label1!.Text += Environment.NewLine + datetime.ToString("  yyyy年M月d日 H时m分s秒");//显示时间信息}/// <summary>/// 加1分钟/// </summary>private void Button1_Click(object? sender, EventArgs e){datetime = DateAndTime.DateAdd(DateInterval.Minute, 1, datetime);label1!.Text += Environment.NewLine + datetime.ToString("  yyyy年M月d日 H时m分s秒");}/// <summary>/// 加1小时/// </summary>private void Button2_Click(object? sender, EventArgs e){datetime = DateAndTime.DateAdd(DateInterval.Hour, 1, datetime);label1!.Text += Environment.NewLine + datetime.ToString("  yyyy年M月d日 H时m分s秒");}/// <summary>/// 加1天/// </summary>private void Button3_Click(object? sender, EventArgs e){datetime = DateAndTime.DateAdd(DateInterval.Day, 1, datetime);label1!.Text += Environment.NewLine + datetime.ToString("  yyyy年M月d日 H时m分s秒");}/// <summary>/// 减1天/// </summary>private void Button4_Click(object? sender, EventArgs e){datetime = DateAndTime.DateAdd(DateInterval.Day, -1, datetime);label1!.Text += Environment.NewLine + datetime.ToString("  yyyy年M月d日 H时m分s秒");}}
}

 

2.实例2:用DateTime.Add方法

// Add 方法计算从此刻起 1天 (864 小时) 后是星期几
namespace _063_1
{internal class Program{private static void Main(string[] args){ArgumentNullException.ThrowIfNull(args);DateTime today = DateTime.Now;TimeSpan duration = new(1, 0, 0, 0);DateTime answer = today.Add(duration);Console.WriteLine("{0:dd}", answer);      // DayConsole.WriteLine("{0:ddd}", answer);    // Day nameConsole.WriteLine("{0:dddd}", answer);  // Full day name}}
}
//运行结果:
/*
27
周六
星期六*/

http://www.khdw.cn/news/41861.html

相关文章:

  • 如何做网站推广下拉刘贺稳14seo有哪些经典的案例
  • 免费企业网站源码下载seo和sem的区别与联系
  • 中国商务平台seo顾问培训
  • 网上做游戏赚钱的网站有哪些南京疫情最新消息
  • 制作表白网页成都关键词优化平台
  • 做网站做什么赚钱业务多平台怎么样
  • 营销型网站应必备的七大功能2345网址导航官网官方电脑版下载
  • jsp购物网站开发视频洛阳市网站建设
  • asp伪静态网站如何做筛选推广网站平台
  • 苏州h5网站建设价格网站推广排名公司
  • 工程规范查询网seo外包公司
  • python做网站快么网站优化网
  • 网站开发人员工具搜索引擎seo如何优化
  • php制作网站免费隐私网站推广app
  • 厦门建网站多少钱网络营销推广与策划
  • 深圳网站建设 cms湖南网络推广机构
  • 上海网站优化排名网站设计与制作毕业论文范文
  • 合肥做网站公一份完整的品牌策划方案
  • 沈阳网站建设电话seo工作流程
  • 做鞋用什么网站好天津seo推广优化
  • 乐从做网站网页设计制作
  • 达州达县网站建设清博大数据舆情监测平台
  • 河北优化网站获客qq网站宣传方式有哪些
  • 国外做免费的视频网站外贸推广如何做
  • 提供做网站服务好谷歌网页版
  • 东莞网站建设模板设计商品营销推广的方法有哪些
  • 免费一站式网站建设百度账号设置
  • 网页设计网站模板网站建设网页模板优化设计五年级上册语文答案
  • 上海建网站服务器郑州seo外包费用
  • 网站建设推广保举火13星优化模型