datetime-format

strtotime for DD/MM/YYYY not working properly [duplicate]

Deadly 提交于 2021-02-08 10:00:11
问题 This question already has answers here : Convert one date format into another in PHP (16 answers) Date in a URL dd/mm/yyyy (1 answer) Closed 1 year ago . I got this type of date from DB '10/09/19' It's today date(10th sept 2019). $date = '10/09/19'; //DD/MM/YY $newdate=date('Y-m-d',strtotime(str_replace('/', '-', $date))); echo $newdate; //output 2010-09-19 exit; It's giving me 2010-09-19. it means 19th Sept 2010 . I expect 10-09-2019 (10th Sept 2019). I already tried many solutions from SO

Difference between two datetime formats in android?

落花浮王杯 提交于 2021-02-07 20:39:24
问题 As i am new to android development I am unable to find code for calculating the difference between two datetime formats. My question is. I am using webservice in my project where i am getting datetime response as follows.. starttime :- [2012-11-04 10:00:00] endtime :- [2012-11-04 12:00:00] Here i want to display on screen as Today Timings :- 2012-11-04 2 hours Means need to calculate the difference between two dates and need to display the time difference on screen. Can anyone please help me

How to define DateTime parse format for general date format with optional time part?

佐手、 提交于 2021-02-07 19:39:39
问题 What is the right DateTime format to parse a date from string in general date format ("G") with optional time part ("d") ? I can have two types of dates: "12/13/2012 6:30:00 PM" "3/29/2013" How to parse them in unified way? Right now I'm trying to parse with "G" format and then if it not parsed with "d" format. 回答1: If your CurrentCulture supports MM/dd/yyyy h:mm:ss tt (I assume your LongTimePattern has h ) and M/dd/yyyy (I assume your ShortDatePattern has M ) as standard date and time format

Timeserie datetick problems when using pandas.DataFrame.plot method

折月煮酒 提交于 2021-02-07 09:31:34
问题 I just discovered something really strange when using plot method of pandas.DataFrame . I am using pandas 0.19.1 . Here is my MWE: import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates import pandas as pd t = pd.date_range('1990-01-01', '1990-01-08', freq='1H') x = pd.DataFrame(np.random.rand(len(t)), index=t) fig, axe = plt.subplots() x.plot(ax=axe) plt.show(axe) xt = axe.get_xticks() When I try to format my xticklabels I get strange beahviours, then I

Get current time including seconds from Sys.Date() in R

可紊 提交于 2021-02-07 05:06:41
问题 I am sure this is pretty basic, but I am not able to extract various peices of time from the system date. Simply, I am not sure why I can not accurately extract the current minutes and seconds using %M or %S. Any thoughts? It currently is 12:38 pm on my machine. > format(Sys.Date(), "%c") [1] "12/16/2011 12:00:00 AM" > R.Version() $platform [1] "i386-pc-mingw32" $arch [1] "i386" $os [1] "mingw32" $system [1] "i386, mingw32" $status [1] "" $major [1] "2" $minor [1] "14.0" $year [1] "2011"

How can I retrieve datetiime from mongodb? By comparing the data with jDateChosser Java

ε祈祈猫儿з 提交于 2021-02-05 12:27:43
问题 private void showdataTable_btnActionPerformed(java.awt.event.ActionEvent evt) { try { DateFormat df = new SimpleDateFormat("YYYY-mm-dd'T'HH:MM:ss'Z'"); //set date format String set = df.format(dateChoos1.getDate()); //add value to set BasicDBObject whereQuery = new BasicDBObject(); whereQuery.put("datetimes", set); //where date via set(date) DBCursor cursor = table.find(whereQuery); while (cursor.hasNext()) { DBObject obj = cursor.next(); String ip_address = (String) obj.get("ip_address");

Timestamp can't be parsed Issue java.time.format.DateTimeParseException: Text '9/25/2020, 12:46:00 PM' could not be parsed at index 0 [duplicate]

自古美人都是妖i 提交于 2021-02-02 09:46:05
问题 This question already has answers here : Error: Text '1/31/2020' could not be parsed at index 0 while trying to parse string date (2 answers) Problem with parse a LocalDateTime using java 8 (2 answers) How to parse a 1 or 2 digit hour string with Java? (5 answers) Closed 4 months ago . I am attempting to capture the time before and after I check a timestamp value on a webpage and then confirm my timestamp falls in between those times. However, I'm struggling to convert my String timestamp

Dates in Safari appear off by one using Intl.DateTimeFormat with en-US locale

大憨熊 提交于 2021-01-29 17:52:25
问题 It looks like Safari's implementation of Int.DateTimeFormat assumes that the second Sunday in March will ALWAYS be the DST time cutoff which is not correct as prior to 2007 it was the first Sunday in April. It also appears that this affects the other end as well when DST ends. PS: This code is being run in Indiana, USA which is in the eastern time zone (GMT-4) More specifically... 2007 and newer: correctly for all dates. 2006: incorrectly for dates between the second Sunday in March and first

How can i convert String to Date when it has “TRT” in it

瘦欲@ 提交于 2021-01-28 12:23:38
问题 String sDate = "06.08.2020" // 06 day 08 month 2020 is year This is the date i have in my txt file. I use them in JTable. To sort the table i convert them to date with this DateFormatter. DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy"); And it does convert the string to date as this. LocalDate date = LocalDate.parse(sDate,formatter); //The date : Thu Aug 06 00:00:00 TRT 2020 Now i need to convert it like the first date 06.08.2020 . But i can't use date as input.

Getting negative value in date.gettime()

风格不统一 提交于 2021-01-28 09:19:21
问题 Facing an issue where I am trying to parse a string value into date and when I try to do date.getTime() I am getting negative value. This is the string I am parsing "01:00:07". and this is the value in date object I get "Thu Jan 01 01:00:07 GMT+05:30 1970". Still in getTime() I am getting negative value "-16193000" Code for achieving this : long sum = 0; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("hh:mm:ss");// I have also tried "HH:mm:ss" format. it gives same result Date date