sdf

日期格式化跨年bug,是否与你不期而遇?

a 夏天 提交于 2020-01-04 00:27:30
public class DateFormatBug { public static void main(String[] args) throws ParseException { // 示例一 printBugDate(); } private static void printBugDate() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); Date date = sdf.parse("2020-1-1 13:12:12"); System.out.println(date); String dateStr = sdf.format(date); System.out.println(dateStr); } } 打印日志为: Sun Dec 29 13:12:12 CST 2019 2020-12-29 13:12:12 示例二,延伸示例: private static void printBugDateExtend() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); Date date = sdf

How to create a dynamic query in a local report(.rdlc) in c#

浪子不回头ぞ 提交于 2019-12-25 05:08:40
问题 In my application I have 3 report.rdlc files that records are not different I am creating a query in a form with options buttons, checkboxes and combobox values string qry = ""; SqlCeConnection cnn = new SqlCeConnection(Properties.Settings.Default.ConnectionString.ToString()); SqlCeCommand cmd = new SqlCeCommand(); if (radioButton1.Checked == true) { qry = @"Select Did,Cid,Source,Destination,Sid,cost,sdate,Driver.fname+' '+Driver.lname as driver,payed from Service,Driver where Service.Did

【Java】【19】Date Calendar相关

半世苍凉 提交于 2019-12-24 23:40:45
前言: 发现开发过程当中要用到时间和日历的情况太多了,这里把我碰到的情况记录一下。 1,获取某月天数 2,获取两个日期之间的天数 3,查询当前日期前(后)x天的日期 4,获取某日期的前(后)N月的年月 5,周六周日判断 6,两个时间比较大小 7,计算年龄 8,发布时间的显示(距离当前时间多少小时,多少天) 9,判断是否是今天 10,日期转成周几 11,当前季度 12,当前时间的上一季度时间(分别为年、第几季度、季度的首月 ) 13,是否是中国春节月 14,获取一个时间的本周时间列表和上周时间列表 15,判断两段时间是否有重叠部分 16,获取当前是第多少周 正文: 1,获取某月天数 public static int getMaxDay(int year, int month) { Calendar cal = Calendar.getInstance(); //创建对象。不用new Calendar()的原因是Calendar是一个抽象类,且其构造方法是protected cal.clear(); //将所有字段值和时间值设置为未定义。Calendar类在set的时候,并不会立即生效,只有在get的时候才会生效,所以要先清理 cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month-1); return time

The selected object(s) use an unsupported database provider

…衆ロ難τιáo~ 提交于 2019-12-24 00:54:58
问题 I'm using Visual Studio 2010 In my project I was added a local database Data.sdf Now I wanna use LINQ TO SQL with it, but when I drag and drop the database table into the LINQ designer , I get the following error in Visual Studio : "The selected object(s) use an unsupported database provider" Am I miss something ? How can I fix it ? 回答1: LINQ-to-SQL is only officially supported when used with a full version of Microsoft SQL Server (including Express editions). While it's possible to use it

Java Scanner用法详解

天涯浪子 提交于 2019-12-17 23:18:49
一、Scanner类简介 Java 5添加了java.util.Scanner类,这是一个用于扫描输入文本的新的实用程序。它是以前的StringTokenizer和Matcher类之间的某种结合。由于任何数据都必须通过同一模式的捕获组检索或通过使用一个索引来检索文本的各个部分。于是可以结合使用正则表达式和从输入流中检索特定类型数据项的方法。这样,除了能使用正则表达式之外,Scanner类还可以任意地对字符串和基本类型(如int和double)的数据进行分析。借助于Scanner,可以针对任何要处理的文本内容编写自定义的语法分析器。 二、Scanner类用法 Scanner是SDK1.5新增的一个类,可使用该类创建一个对象。 Scanner reader=new Scanner(System.in);  然后reader对象调用下列方法(函数),读取用户在命令行输入的各种数据类型   next.Byte(),nextDouble(),nextFloat,nextInt(),nextLine(),nextLong(),nextShot()  上述方法执行时都会造成堵塞,等待用户在命令行输入数据回车确认.例如,拥护在键盘输入12.34,hasNextFloat()的值是true,而hasNextInt()的值是false。NextLine()等待用户输入一个文本行并且回车

SQL Server CE .sdf merge

纵然是瞬间 提交于 2019-12-11 23:05:41
问题 My application is running on Windows CE 6.0, and it uses a SQL Server CE .sdf file to store user data. The application is running on an industrial device, which is not connected to internet. The only way to update the software is to plug a USB stick inside. As expected, the first release 1.0 of the application needs to update to 1.1 now, the database schema as well. How could I merge the .sdf version 1.0 which is on the device with the latest 1.1 database schema that will be available through

获取当前年月日时分秒方法

无人久伴 提交于 2019-12-11 18:29:37
Java public static void main(String[] args) throws ParseException { Calendar now = Calendar.getInstance(); System.out.println("年: " + now.get(Calendar.YEAR)); System.out.println("月: " + (now.get(Calendar.MONTH) + 1) + ""); System.out.println("日: " + now.get(Calendar.DAY_OF_MONTH)); System.out.println("时: " + now.get(Calendar.HOUR_OF_DAY)); System.out.println("分: " + now.get(Calendar.MINUTE)); System.out.println("秒: " + now.get(Calendar.SECOND)); System.out.println("当前时间毫秒数:" + now.getTimeInMillis()); System.out.println(now.getTime()); Date d = new Date(); System.out.println(d);

Converting MDF to SDF

让人想犯罪 __ 提交于 2019-12-11 10:38:10
问题 I've done a bit of Googling trying to find out how to convert a .MDF file to a .SDF . There doesn't seem to be much around apart from an old article for something called 'SQL Server to SQL Server Compact Edition Database Copy Utility'. As this is so old, I doubt it will work with the newer versions of SQL Server databases. Is there a more established and official method of achieving this now? Ideally I need something that will migrate the data as well as the table structures. 回答1: You can use

java和javascript日期详解

时光毁灭记忆、已成空白 提交于 2019-12-10 01:29:40
** java,js日期转换:** <Excerpt in index | 首页摘要> java的各种日期转换 <The rest of contents | 余下全文> 日期表示类型 获取long类型的日期格式 1234 long time = System.currentTimeMillis();System.out.printf(time+"");Date date =new Date();System.out.println(date.getTime()); 获取制定格式的日期 123 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");Date date =new Date();System.out.println(sdf.format(date) ); 把制定格式的日期转为date或者毫秒值 123 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");Date date = sdf.parse("2016-05-22 10:15:21");long mills = date.getTime(); 说明:System.currentTimeMillis()并不能精确到1ms的级别,它取决于运行的系统

利用Python对链家网北京二手房进行简单数据分析

吃可爱长大的小学妹 提交于 2019-12-08 21:25:48
#首先我用爬虫获取到了链家二手房的一万多条信息,我在爬去的时候对空置进行了处理 本文主要讲述如何通过pandas对爬虫下来的链家数据进行相应的二手房数据分析,主要分析内容包括各个区,各个小区的房源信息情况 #导入主要的模块 import pandas as pd import numpy as np import matplotlib.pyplot as plt #读取数据 house = pd.read_csv( r'C:\Users\cz\Desktop\fang.csv' , names =[ 'id' , 'title' , 'link' , 'community' , 'housetype' , 'direction' , 'floor' , 'region' , 'totalprice' , 'followinfo' , 'unitprice' , 'acreage' , 'frequency' ]) #然后查看是否有数据 #获取总价格全五的数据 house.sort_values( 'totalprice' , ascending = False ).head( 5 ) #结果 id title link community housetype direction floor region totalprice followinfo unitprice acreage