using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using ConsoleApplication1;
using log4net;

namespace ISC.LPCheck.HashValue
{
    static class Program
    {
        static void Main()
        {
            string title = "日付";
            string str1 = "2016年10月12日";
            DateTime dt1 = Convert.ToDateTime(str1);
            string str3 = "2016年7月12日";
            DateTime dt3 = Convert.ToDateTime(str3);
            int index = 1;
           
            List<string> newList = new List<string>();
 
            foreach (var file in Directory.GetFiles(@"C:\ECsystem\Pv_Click\download\csv\20161019"))
            {
                foreach (var item in File.ReadAllLines(file, Encoding.UTF8))
                {

                    if (item.Contains(title) && index == 1)
                    {
                        newList.Add(item); //添加title
                    }
                    else if(!item.Contains(title))
                    {
                        var hitukistr = item.Split(',')[0].Replace("\"", "");
                        DateTime dt2 = Convert.ToDateTime(hitukistr);
                        if (DateTime.Compare(dt1, dt2) >= 0 && DateTime.Compare(dt2, dt3) >= 0)
                        {
                            newList.Add(item);
                        }
                    }
                    Console.WriteLine(item);
                    index++;
                }
            }
            File.WriteAllLines(@"C:\ECsystem\Pv_Click\download\csv\20161019\test1.csv", newList.ToArray(), Encoding.UTF8);

        }

    }
}

根据日期 读取三个csv不留指定日期的内容 新保存一个文件的更多相关文章

  1. Java各种日期格式的获取和设置指定日期

    因为近期在做一个项目,发现项目中日期设置的bug,于是查阅了多方资料后.最终攻克了,为此写篇总结.方便日后的查阅. 多的不说了.直接上代码 package com.example.testdate; ...

  2. android逐行读取文件内容以及保存为文件

    用于长时间使用的apk,并且有规律性的数据 1,逐行读取文件内容 //首先定义一个数据类型,用于保存读取文件的内容 class WeightRecord { String timestamp; flo ...

  3. C#读取Access数据表中某一列内容,保存至数组

    string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=product.mdb";OleDbConnecti ...

  4. mssql sqlserver 获取指定日期为本月第几个工作日

    转自:http://www.maomao365.com/?p=6771 摘要: 下文讲述工作中,需要获取指定日期在当月的工作日 下文讲述常规的指定工作日所在月的天数分析,实现思路:1 生成一个国家法定 ...

  5. 深入理解pandas读取excel,txt,csv文件等命令

    pandas读取文件官方提供的文档 在使用pandas读取文件之前,必备的内容,必然属于官方文档,官方文档查阅地址 http://pandas.pydata.org/pandas-docs/versi ...

  6. JS计算指定日期是距今的第几周,星期几

    无意中在百度知道上发现这样一个问题,就抽时间见写了一个函数. 首先我们需要明确,既然是指定日期距今的第几周,那么就要知道指定的日期是什么,而且是不能确定的,会根据使用者不同而得到不同的日期,所以我们需 ...

  7. 使用DateAdd方法向指定日期添加一段时间间隔,使用TimeSpan对象获取时间间隔

    一:使用DateAdd方法向指定日期添加一段时间间隔,截图 二:代码 using System; using System.Collections.Generic; using System.Comp ...

  8. 通过oledb驱动读取excel、csv数据丢失解决方案

    1.问题出现 在开发应用程序的过程中,比较常用一功能就是通过oledb驱动读取excel.csv.text等文件:而最近有客户反映,在使用短信平台(下载地址:http://www.sms1086.co ...

  9. python读取与写入csv,txt格式文件

    python读取与写入csv,txt格式文件 在数据分析中经常需要从csv格式的文件中存取数据以及将数据写书到csv文件中.将csv文件中的数据直接读取为dict类型和DataFrame是非常方便也很 ...

随机推荐

  1. Python 基礎 - 字符編碼

    Python 解釋器在加載 .py 文件中的代碼時,會對內容進行編碼 (默認 ascill) ASCII (American Standard Code for Information Interch ...

  2. ListView去除顶部和底部边缘阴影(亲测4.4及以前的版本都适用)

    ListView滑动到顶部和底部时出现的阴影消除方法:android2.3以前用android:fadingEdge="none"android2.3以后用android:over ...

  3. Apache日志轮替规则

     linux : |/usr/local/sbin/cronolog /web/apache/logs/%Y%m%daccess_log    <IfModule log_config_modu ...

  4. Altium Designer 画"差分线"

    Altium Designer 画"差分线" 如何在 Altium Designer 中快速进行差分对走线1:在原理图中让一对网络前缀相同,后缀分别为_N 和_P,并且加上差分队对 ...

  5. register_chrdev_region/alloc_chrdev_region和cdev注册字符设备驱动

    内核提供了三个函数来注册一组字符设备编号,这三个函数分别是 register_chrdev_region().alloc_chrdev_region() 和 register_chrdev(). (1 ...

  6. std::ostringstream输出流详解

    一.简单介绍 ostringstream是C++的一个字符集操作模板类,定义在sstream.h头文件中.ostringstream类通常用于执行C风格的串流的输出操作,格式化字符串,避免申请大量的缓 ...

  7. Linux之Qt利用Sqlite静态编译库(转)

    参考:http://www.linuxidc.com/Linux/2011-11/47465.htm sqlite3编译安装 ------------------------arm版--------- ...

  8. ps6 安装失败-FATAL: Payload '{3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.98.0' information not found in Media_db.

    点击 '错误摘要' Exit Code: 34 -------------------------------------- Summary ----------------------------- ...

  9. error while loading shared libraries:错误的原因和解决方法

    原因有两个: 1.操作系统没有改共享库 2.安装了该共享库,但是执行外部程序调用该共享库的时候,程序按照默认路径(/usr/lib./lib)找不到该共享库文件 解决方法: ubuntu系统的共享库一 ...

  10. HTML标签_01

    <!DOCTYPE html> <html> <body> <h1>我的第一个标题</h1> <p>我的第一个段落.</p ...