date

how to get only date part from date string in C#

≯℡__Kan透↙ 提交于 2020-06-02 06:18:11
问题 i need to get in this format "2015-10-03" , but im getting like this "10/3/2015" and "10/3/2015 12:00:00 AM" both are not working in my query .because my updateddate datatype is date only Fromdate = Txtbox_AjaxCalFrom.Text.Trim();// 10/3/2015 DateTime frmdt = Convert.ToDateTime(Fromdate);// 10/3/2015 12:00:00 AM ToDate = Txtbox_AjaxCalTo.Text.Trim(); DateTime todt = Convert.ToDateTime(Fromdate); i want query like this updateddate between '2015-10-03' and '2015-10-03' full query gvOrders

LocalDateTime Java - Get same day of week for next month

≯℡__Kan透↙ 提交于 2020-06-01 07:50:06
问题 I have a date and a time of a month, for example 31/01/2020 at 14:00:00 , this is the last friday of January. How can I get the date for the last Friday of Feb, March, etc.? It should be dynamic because any date can come in, like the second Tuesday of any month and so on. I am trying with the following with no luck: LocalDateTime startTime = LocalDateTime.of(2020, 1, 31, 14, 0, 0); final Calendar calendar = Calendar.getInstance(); calendar.set(startTime.getYear(), startTime.getMonthValue() -

How to display real dates in a loop in r

ぐ巨炮叔叔 提交于 2020-05-30 08:42:07
问题 When I iterate over dates in a loop, R prints out the numeric coding of the dates. For example: dates <- as.Date(c("1939-06-10", "1932-02-22", "1980-03-13", "1987-03-17", "1988-04-14", "1979-08-28", "1992-07-16", "1989-12-11"), tryFormats = c("%Y-%m-%d")) for(d in dates){ print(d) } The output is as follows: [1] -11163 [1] -13828 [1] 3724 [1] 6284 [1] 6678 [1] 3526 [1] 8232 [1] 7284 How do I get R to print out the actual dates? So the output reads: [1] "1939-06-10" [1] "1932-02-22" [1] "1980

Java Calendar.DAY_OF_WEEK gives wrong day

好久不见. 提交于 2020-05-29 11:37:08
问题 What is wrong with the below code? It gives wrong day for any date of the year. import java.util.Scanner; import java.util.Calendar; public class Solution { public static String getDay(String d, String m, String y) { String[] days = {"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"}; Calendar c = Calendar.getInstance(); c.set(Integer.parseInt(y), Integer.parseInt(m), Integer.parseInt(d)); return days[c.get(Calendar.DAY_OF_WEEK) - 1]; } public static void main

Python 3D plot with dates

雨燕双飞 提交于 2020-05-29 11:24:50
问题 I am trying to make a 3D scatter plot that has the following axis: Price, Time and Dates. Essentially I want to plot the price vs the time for a single day and then do that for multiple days and stack them on an axis. Here is the code I have so far: df=pd.read_csv("C:\\Desktop\\dat.csv") date= df['date'].unique() dfd = pd.DataFrame(date) days= dfd.sort_values(0) fig= plt.figure() ax= fig.add_subplot(111, projection= '3d') xx = np.arange(len(days[0])) ys = [i+xx+(i*xx)**2 for i in range(len

Python 3D plot with dates

自古美人都是妖i 提交于 2020-05-29 11:22:30
问题 I am trying to make a 3D scatter plot that has the following axis: Price, Time and Dates. Essentially I want to plot the price vs the time for a single day and then do that for multiple days and stack them on an axis. Here is the code I have so far: df=pd.read_csv("C:\\Desktop\\dat.csv") date= df['date'].unique() dfd = pd.DataFrame(date) days= dfd.sort_values(0) fig= plt.figure() ax= fig.add_subplot(111, projection= '3d') xx = np.arange(len(days[0])) ys = [i+xx+(i*xx)**2 for i in range(len

Safari new Date with string value outs different time [duplicate]

我怕爱的太早我们不能终老 提交于 2020-05-29 09:53:27
问题 This question already has answers here : Why does Date.parse give incorrect results? (11 answers) Closed last year . What I am trying to do is changing "yyyy-mm-dd HH:mm:ss" string to date value. Here is the current code var c = new Date('2019-01-19 23:59:59'.replace(/\s+/g, 'T')) It returns chrome : Sat Jan 19 2019 23:59:59 GMT+0900 (KST) safari : Sun Jan 20 2019 08:59:59 GMT+0900 (KST) ie11 : Sat Jan 19 2019 23:59:59 GMT+0900 (KST) What should I do to make it returns all same date? Thanks.

How to shift dates in a pandas dataframe (add x months)?

放肆的年华 提交于 2020-05-29 07:12:48
问题 I have a dataframe with columns of dates. I know how to shift dates by a fixed number of months (eg add 3 months to all the dates in column x); however, I cannot figure out how to shift dates by a number of months which is not fixed, but is another column of the dataframe. Any ideas? I have copied a minimal example below. The error I get is: The truth value of a Series is ambiguous Thanks a lot! import pandas as pd import numpy as np import datetime df = pd.DataFrame() df['year'] = np.arange

get current Date from internet in android

六月ゝ 毕业季﹏ 提交于 2020-05-28 07:36:05
问题 I want to know if there is any API/class in android which can give us the original date as I do not want to get the date/time from android device. 回答1: Updated!! The old answer does not work because the timeapi.org is down. Here is the my new getTime method. It's using JSOUP . private long getTime() throws Exception { String url = "https://time.is/Unix_time_now"; Document doc = Jsoup.parse(new URL(url).openStream(), "UTF-8", url); String[] tags = new String[] { "div[id=time_section]", "div[id

Pyspark from_unixtime (unix_timestamp) does not convert to timestamp

|▌冷眼眸甩不掉的悲伤 提交于 2020-05-28 04:17:46
问题 I am using Pyspark with Python 2.7. I have a date column in string (with ms) and would like to convert to timestamp This is what I have tried so far df = df.withColumn('end_time', from_unixtime(unix_timestamp(df.end_time, '%Y-%M-%d %H:%m:%S.%f')) ) printSchema() shows end_time: string (nullable = true) when I expended timestamp as the type of variable 回答1: Try using from_utc_timestamp: from pyspark.sql.functions import from_utc_timestamp df = df.withColumn('end_time', from_utc_timestamp(df