iso8601

ISO week number in VBScript or VBA

↘锁芯ラ 提交于 2020-02-24 11:29:27
问题 How can I get the ISO week number of some date in VBScript or VBA? 回答1: First, note that: It is important to report the week year along with the week number, as the date's year could be different. Several Windows components contain a bug for some years' last Monday. In my experience the simplest, clearest and most robust way to compute this is: Sub WeekNum(someDate, isoWeekYear, isoWeekNumber, isoWeekDay) Dim nearestThursday isoWeekDay = WeekDay(someDate, vbMonday) nearestThursday = DateAdd(

Parse date of ISO 8601 value 24:00:00 fails

江枫思渺然 提交于 2020-02-03 07:02:51
问题 I'm trying to parse incoming date from data source (which cannot be changed). It gives me time in ISO 8601 format example: 2007-04-05T24:00 . How ever in .Net it fails to parse this as valid time. The wikipedia states that it should be valid format. Wikipedia ISO 8601 Example from https://stackoverflow.com/a/3556188/645410 How can I do this without a nasty string check hack? Example (fiddle: http://dotnetfiddle.net/oB7EZx): var strDate = "2007-04-05T24:00"; Console.WriteLine(DateTime.Parse

Windows ISO 8601 timestamp

我与影子孤独终老i 提交于 2020-01-31 07:07:07
问题 I need to convert a date in Windows PowerShell to the ISO 8601 format. In Linux/Unix it was no problem with TZ=0 date -d "<random-format>" +%Y-%m-%dT%H:%M:%S.000Z Now I need to do the same in Windows PowerShell. The output format on Windows is Wednesday, 19. July 2017 01:06:13 How can I do it? 回答1: PowerShell's Get-Date supports standard .NET time formats. The o round-trip format complies with ISO 8601. Like so, Get-Date -Format "o" 2017-08-15T12:10:34.4443084+03:00 回答2: Get-Date supports

What is a good format for Duration in JSON?

情到浓时终转凉″ 提交于 2020-01-24 10:52:18
问题 I realise that JSON has no real date format and that using ISO 8601 is a good bet given that's what JavaScript uses. What about a duration? JavaScript has no built in format. I came across ISO 8601 Durations e.g. P3Y6M4DT12H30M5S which I haven't seen used much in the wild. It also looks very verbose and difficult to read. As far as I can see it also does not support milliseconds if you needed that. I'm using C# whose TimeSpan type outputs 1.02:03:04.0050000 for 1 day, 2 hours, 3 minutes, 4

Regular expression for full ISO 8601 date syntax

大憨熊 提交于 2020-01-24 07:03:18
问题 Update: Currently, a working solution has been achieved with multiple regular expressions used simultaneously I'm looking for a regular expression that covers the range of acceptable syntax for ISO 8601 dates. Most libraries and regex's only cover a subset or a "simplified" version of 8601, such as RFC 3339, but the full 8601 includes ways to express time durations and intervals. The wikipedia entry for ISO 8601 provides a good overview, but in short these should all be valid dates: var

Validate an ISO-8601 datetime string in Python?

*爱你&永不变心* 提交于 2020-01-22 16:17:07
问题 I want to write a function that takes a string and returns True if it is a valid ISO-8601 datetime--precise to microseconds, including a timezone offset-- False otherwise. I have found other questions that provide different ways of parsing datetime strings, but I want to return True in the case of ISO-8601 format only. Parsing doesn't help me unless I can get it to throw an error for formats that don't match ISO-8601. (I am using the nice arrow library elsewhere in my code. A solution that

convert string timestamp to ISO 8601 compliant string

我们两清 提交于 2020-01-07 05:31:04
问题 I have a timestamp and offset in string format as shown below in two different variables: 01/14/2016 07:37:36PM -08:00 I want to convert above timestamp into ISO 8601 compliant String, with milliseconds and timezone so it should look like this after conversion: 2016-01-14T19:37:36-08:00 How can I do that? I am using jodatime library. 回答1: The newer java.time classes work so well with ISO 8601 strings. String dateTimeString = "01/14/2016 07:37:36PM"; String offsetString = "-08:00";

How to get a zulu timezone representation of the current date

时光怂恿深爱的人放手 提交于 2020-01-06 02:27:08
问题 I would like to get the current date in ISO 8601 (rfc3339), Zulu format: 2015-10-13T10:26:43Z How can I do this in Javascript? 回答1: You can use toISOString() var isoDate = new Date().toISOString(); console.log(isoDate); Hope it helps, 来源: https://stackoverflow.com/questions/33100656/how-to-get-a-zulu-timezone-representation-of-the-current-date

How would I convert ISO 8601 durations into a seconds or milliseconds in Lua?

本小妞迷上赌 提交于 2020-01-05 13:11:23
问题 I need to implement a lua function to convert the time format in ISO 8601 to seconds or milliseconds, is there any built-in libraries available in Lua or we have to implement? Examples for ISO 8601 format : PT1S, PT0.010S, PT0.001S---> to seconds or milliseconds. 回答1: The code below converts strings of the form PTxxxS : s="PT0.001S" print(tonumber(s:match("PT([%d.]+)S"))) More generally, this code parses a duration string into a table, which you can then process easily: s= "P3Y6M4DT12H30M5S"

how to handle DST and timezones in JavaScript

柔情痞子 提交于 2020-01-05 03:41:08
问题 What is the best approach for dealing with DST values when your web service accepts requests from different timezones than that of your server? My webservice accepts date strings using the ISO8601 standard (2012-02-21T05:00:00.000-05:00) I want to account for DST but don't want the overhead of maintaining or connecting to a database to get the DST for each request which comes in from a different timezone to my server. One approach im considering is using the servers default DST settings and