iso8601

How do I store an UTC ISO8601 date in a MySQL database?

烈酒焚心 提交于 2019-12-03 04:38:16
I have thousands of dates in the following format: 2011-10-02T23:25:42Z (aka ISO 8601 in UTC) What MySQL data type should I use for storing such a ISO8601 date in a MySQL database? E.g. Datetime , timestamp or something else? Which is best for comparison (eg. getting records between two dates/times) and ordering the results from queries? What about if the database is very large? And what would be the best way to convert the above PHP string for MySQL storage? (I'm guessing date_default_timezone_set('UTC'); would be used?) I think that keeping your date-time values in field of type DATETIME

`date` command on OS X doesn't have ISO 8601 `-I` option?

早过忘川 提交于 2019-12-03 00:12:32
问题 In a Bash script, I want to print the current datetime in ISO 8601 format (preferably UTC), and it seems that this should be as simple as date -I : http://ss64.com/bash/date.html But this doesn't seem to work on my Mac: $ date -I date: illegal option -- I usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format] And indeed, man date doesn't list this option. Anyone know why this is, or any other (easy) way for me to

ISO8601 formatted string to DateTime [closed]

喜夏-厌秋 提交于 2019-12-02 21:28:01
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago . I have the following ISO8601 formatted date time string: 2016-03-28T16:07:00+0200 I want to convert it into a C# DateTime object, but the parsing method I'm using throws an exception. Currently I have this: (Does not work) string format = "yyyy-MM-ddTHH:mm:ss+zzzz"; CultureInfo provider =

R strptime Monday date from weeknumber weird

对着背影说爱祢 提交于 2019-12-02 18:17:16
问题 I am making a trivial error here but cannot get my head around figuring out what is the problem. I need to get the date of the Monday of the week of a random date.. Seems I am getting something quite different mydate <- date("2013-11-05") format(mydate, "%A") # this is Tuesday, right #[1] "Tuesday" month(mydate) # Month November, right #[1] 11 myyr <- year(mydate); myyr # year is 2013, right #[1] 2013 day(mydate) # day number is 5, right #[1] 5 mywk <- isoweek(mydate);mywk # weeknumber is 45,

`date` command on OS X doesn't have ISO 8601 `-I` option?

青春壹個敷衍的年華 提交于 2019-12-02 13:58:11
In a Bash script, I want to print the current datetime in ISO 8601 format (preferably UTC), and it seems that this should be as simple as date -I : http://ss64.com/bash/date.html But this doesn't seem to work on my Mac: $ date -I date: illegal option -- I usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format] And indeed, man date doesn't list this option. Anyone know why this is, or any other (easy) way for me to print the date in ISO 8601 format? Thanks! amit_g You could use date "+%Y-%m-%d" Or for a fully ISO-8601

Swift NSDate iso 8601 format

夙愿已清 提交于 2019-12-02 12:59:45
问题 I am working on date formats in swift. Trying to covert string date to NSDate and NSSate to string date (ISO 8601 format) This is my code let stringDate = "2016-05-14T09:30:00.000Z" // iso 8601 format let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" //iso 8601 let date = dateFormatter.dateFromString(stringDate) print("Date = \(date)") // Output is 2016-05-14 16:30:00 +0000 // again converting it date to string using stringFromDate print("\

ISO8601 formatted string to DateTime [closed]

浪子不回头ぞ 提交于 2019-12-02 11:09:34
I have the following ISO8601 formatted date time string: 2016-03-28T16:07:00+0200 I want to convert it into a C# DateTime object, but the parsing method I'm using throws an exception. Currently I have this: (Does not work) string format = "yyyy-MM-ddTHH:mm:ss+zzzz"; CultureInfo provider = CultureInfo.InvariantCulture; // Throws the exception: "String was not recognized as a valid DateTime." DateTime time = DateTime.ParseExact("2016-03-28T16:07:00+0200", format, provider); How do I get the parse function to work with my string? Try DateTime time = DateTime.Parse("2016-03-28T16:07:00+0200"); .

What is the value of the ISO 8601 duration `P1M` (in seconds)?

▼魔方 西西 提交于 2019-12-01 22:16:37
Suppose I have an ISO 8601 duration, expressed as "P1M" . Phrased colloquially, this means "one month." Is there a standard rule for converting this into a number of seconds, assuming the start date is not known? For 30-day months, it might be 2,592,000. For 31-day months, it might be 2,678,400. In February, it might be 2,419,200 or it might be 2,505,600. My gut says there's no way to resolve "one month" to an exact number of seconds without knowing context, and where those seconds are laid out on the calendar. But are there standard rules/conventions to calculate these durations in an

Date/Time Conversion ColdFusion

白昼怎懂夜的黑 提交于 2019-12-01 18:51:37
I'm working with a script that displays the date and time in ISO 8601 format like so: 2012-05-17T17:35:44.000Z . but I would like it to display in the normal ColdFusion timestamp format when using the #Now()# notation ... so in this format: {ts '2012-05-17 17:35:44'} How can I do this? As of CF 10, ISO-8601 is supported directly by parseDateTime . <cfset string = "1997-07-16T19:20:30+01:00"> <cfset date = parseDateTime(string, "yyyy-MM-dd'T'HH:mm:ssX")> Runnable Example on TryCF.com Pretty sure just a parse and then output will give it to you in the format you want : #parseDateTime(REReplace(

How to parse an ISO8601 date [duplicate]

白昼怎懂夜的黑 提交于 2019-12-01 14:54:44
This question already has an answer here: How to parse a date string into an NSDate object in iOS? 7 answers I got string of date regarding this format: 2011-12-29T09:09:06-0500 How can I convert this into a date object? Try this solution NSString *dateString = @"2011-12-29T09:09:06-0500"; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"]; NSDate *dateFromString = [dateFormatter dateFromString:dateString]; [dateFormatter release]; NSLog(@" dateFromString %@",dateFromString); divakar NSString *date = [[NSDate date]