Posts

Showing posts with the label datetime

WCF - Store and restore UTC DateTime

WCF - Store and restore UTC DateTime We expose to our customer a WCF webservice allowing them to store DateTime in SQL Server databases. Extract of the WSDL : <xs:complexType name="TimePeriod"> <xs:sequence> <xs:element minOccurs="0" name="endDateTime" nillable="true" type="xs:dateTime"/> <xs:element minOccurs="0" name="startDateTime" nillable="true" type="xs:dateTime"/> </xs:sequence> For exemple, my customer send me UTC Datetime : <af:effectivePeriod> <af:startDateTime>2018-01-16T10:32:28Z</af:startDateTime> </af:effectivePeriod> This is stored in a SQL Server database in a datetime field. datetime But in the output of the read service, I don't have the UTC indicator : <af:effectivePeriod> <af:startDateTime>2018-01-16T10:32:28</af:startDateTime> </af:effectivePeriod> "Z" is kind of a unique...

How to get Date formatted in locale with specific pattern?

How to get Date formatted in locale with specific pattern? After searching, i was unable to find a solution for this problem. i have this: Long parseDt = Long.valueOf(arrayJson.getJSONObject(i-j).getInt("dt")); // dt is a timestamp Locale locale = ConfigurationCompat.getLocales(Resources.getSystem().getConfiguration()).get(0); String date = new SimpleDateFormat("EEE d MMM", locale).format(new java.util.Date(parseDt * 1000)); So, the pattern works but when i change the phone language, it didn't swap the way it displays, i want to mean if the phone language is French it displays the date like this and it is good for most of the european language: lun 2 juil and if i switch language to English, it displays the date like that: mon 2 july instead of: mon july 2 Do you have any clue to solve this problem respecting my pattern knowing that i want the name of the day with 3 characters maximum? The existing predefined format (like FULL) could work but the name of the day...

How to compare between different date formats?

How to compare between different date formats? I have four different date formats that I will store in a DB, Then show the latest ones. The four different formats: $a = '27. júní 2018 04:53'; $b = 'Friday, 09 March 2018'; $c = 'Fri, 29 Jun 2018 11:00:00 GMT'; $d = 'Mon, 18 Jun 2018 06:52:20 +0000'; They will be stored in a MYSQL Database. What should I do with them? Can SQL or MYSQL date type do the work? Should I convert them using strtotime() ? strtotime() Should I extract some data from specific ones to male them match? Can SQL or MYSQL date type do the work? Maybe you should try before asking the question. Please post the code that you have tried and explain which part is not working. – Dvorog Jul 1 at 10:38 php.net/manual/en/function.strtotime.php – WPZA ...

Identifying if a datetime from one dataframe is within an hour after another dataframe

Identifying if a datetime from one dataframe is within an hour after another dataframe I have 2 dataframes, A and B: A abc|def|datetime | 1 |55 |2016-01-28 00:00:00 | 2 |53 |2016-01-28 00:30:00 | 3 |11 |2016-01-28 02:00:00 | B efg|hij|datetime | 4 |ch |2016-01-28 00:11:00 | 5 |jw |2016-01-28 11:30:00 | 6 |q1 |2016-01-28 07:00:00 | I Want to add a true false column to the end of A if a value B is within an hour after. And also a column that shows a value B is within an hour before. A output: abc|def|datetime |After|Before| 1 |55 |2016-01-28 00:00:00 | 0 | 1 | 2 |53 |2016-01-28 00:30:00 | 1 | 0 | 3 |11 |2016-01-28 02:00:00 | 0 | 0 | I have tried using `library(lubridate): for(i in seq(nrow(B))){ for(j in seq(nrow(A))){ if(A$datetime[j] %in% seq(B$datetime[i],B$datetime[i] + hours(1))){ A$After[j] = 1 } } } But i can't get it to work. Any help would be greatly appriciated. Additional Information: The dataframes...

Sort / filter multiple objects in JQ by date

Sort / filter multiple objects in JQ by date I'm trying to use JQ to find the most recent artifact in a Nexus API query. Right now, my JSON output looks something like: { "items" : [ { "downloadUrl" : "https://nexus.ama.org/repository/Snapshots/org/sso/browser-manager/1.0-SNAPSHOT/browser-manager-1.0-20180703.144121-1.jar", "path" : "org/sso/browser-manager/1.0-SNAPSHOT/browser-manager-1.0-20180703.144121-1.jar", "id" : "V0FEQS1TbmFwc2hvdHM6MzhjZDQ3NTQwMTBkNGJhOTY1N2JiOTEyMTM1ZGRjZWQ", "repository" : "Snapshots", "format" : "maven2", "checksum" : { "sha1" : "7ac324905fb1ff15ef6020f256fcb5c9f54113ca", "md5" : "bb25c483a183001dfdc58c07a71a98ed" } }, { "downloadUrl" : "https://nexus.ama.org/repository/Snapshots/org/sso/browser-manager/1.0-SNAPSHOT/browser-manager-1...