datetime-format

How can I convert date time format string used by C# to the format used by moment.js?

那年仲夏 提交于 2020-01-12 06:50:28
问题 C# uses string like that 'dd MMMM yyyy HH:mm' to define format the date and time should be displayed in. Equivalent of that in momentjs is 'DD MMMM YYYY HH:mm' . Is there some function that can covert one format definition into the other regardless of what (legal) combination of format specifiers source format contains? Basically what I want is: function toMomentJsFormatDefinition(cSharpFormatDefinition) { // should convert all format strings described here https://msdn.microsoft.com/en-us

Format a posix time with just 3 digits in fractional seconds

谁都会走 提交于 2020-01-11 10:38:28
问题 What's the equivalent of microsec_clock for milliseconds in the following code? #include <boost/date_time/posix_time/posix_time.hpp> int main() { boost::posix_time::ptime date_time = boost::posix_time::microsec_clock::local_time(); const std::string str_time = boost::posix_time::to_simple_string(date_time); std::cout << str_time << std::endl; return 0; } output: 2015-Jan-25 16:26:14.932738 I need the following output: output: 2015-Jan-25 16:26:14.932 回答1: Indeed, this seems a strange omission

Format a posix time with just 3 digits in fractional seconds

五迷三道 提交于 2020-01-11 10:38:20
问题 What's the equivalent of microsec_clock for milliseconds in the following code? #include <boost/date_time/posix_time/posix_time.hpp> int main() { boost::posix_time::ptime date_time = boost::posix_time::microsec_clock::local_time(); const std::string str_time = boost::posix_time::to_simple_string(date_time); std::cout << str_time << std::endl; return 0; } output: 2015-Jan-25 16:26:14.932738 I need the following output: output: 2015-Jan-25 16:26:14.932 回答1: Indeed, this seems a strange omission

JavaScript datetime parsing [duplicate]

别来无恙 提交于 2020-01-10 01:43:07
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How can I convert string to datetime with format specification in JavaScript? I have a json response which contains a hashmap like; {"map":{"2012-10-10 03:47:00.0":23.400000000000002,"2012-10-10 03:52:00.0":23.3,"2012-10-10 03:57:00.0":23.3,"2012-10-10 04:02:00.0":23.3,"2012-10-10 04:07:00.0":23.200000000000003,"2012-10-10 04:13:00.0":23.1,"2012-10-10 04:18:00.0":23.1,"2012-10-10 04:23:00.0":23.0,"2012-10-10 04

Calculate hours between dates in different time zones

删除回忆录丶 提交于 2020-01-06 20:09:46
问题 I have an array of dates (in different time zones GMT) and I would like to calculate the hours that have elapsed between the first and the last date. For example, this would be an array of dates: [ 1 => 2016-06-05T08:45:00.000+02:00, 2 => 2016-06-05T09:55:00.000+02:00, 3 => 2016-06-05T12:10:00.000+02:00, 4 => 2016-06-05T14:25:00.000-04:00 ] I want to calculate the hours that have elapsed since the date with index 1 to 2, 2 to 3 and from 3 to 4. The problem is I do not know how to calculate

Compare Two different formats of the DateTime

半城伤御伤魂 提交于 2020-01-06 19:51:16
问题 I have EndDate column in my table which accepts records like this 2014-10-29 00:00:00.000 Now I want to compare this DateTime with present date . For that , I did like this :- var today=DateTime.Now; var LstEvents = (from t in _context.Tournaments where t.SiteId == siteId && t.EndDate != null && t.EndDate < today select t).ToList(); But t.EndDate < today is not returning results as I wanted . I did Add Watch for today and checked the value and it's format was like today {11/3/2014 8:12:00 PM}

Compare Two different formats of the DateTime

痞子三分冷 提交于 2020-01-06 19:50:54
问题 I have EndDate column in my table which accepts records like this 2014-10-29 00:00:00.000 Now I want to compare this DateTime with present date . For that , I did like this :- var today=DateTime.Now; var LstEvents = (from t in _context.Tournaments where t.SiteId == siteId && t.EndDate != null && t.EndDate < today select t).ToList(); But t.EndDate < today is not returning results as I wanted . I did Add Watch for today and checked the value and it's format was like today {11/3/2014 8:12:00 PM}

DateTime limits of scale_color_gradient not working only when in for loop in R

不想你离开。 提交于 2020-01-06 15:50:09
问题 I want to generate multiple maps over a base map (TMap). Basically, the same map, but categorized by week. Okay, here's the base code: library(ggplot2) library(ggmap) library(lubridate) map=TMap + geom_point(aes(x=Lon, y=Lat, size=count, color=as.Date(y$`2016-35`$DateTime)), data=y$`2016-35`, alpha=1) + scale_colour_gradient(limits=as.Date(c(min(y$`2016-35`$DateTime), max(y$`2016-35`$DateTime))),low="navy", high="orange", name="Date", trans="date") ggsave(map,path=dir,filename = paste("l",

Java determine one dateformat from several dateformats

泪湿孤枕 提交于 2020-01-06 12:55:49
问题 We want to get a correct dateformat from LOG files generated by different systems with different language and log mechanism. We thought this can be done be a SimpleDataFormat.parse and try-catch exception way. But the follow code shows a problem. String tryparseString = "18-01-22 00:03:34:071"; try { SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); System.out.println(sdf1.parse(tryparseString)); System.out.println(sdf1.format(sdf1.parse(tryparseString))); System.out

VB.NET How to make a custom system time (real-time) [closed]

橙三吉。 提交于 2020-01-06 11:57:26
问题 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 4 years ago . So Im stuck here on my project in VB.Net . I wanted to make a user defined date time function that is not dependent on the system time Ive tried to search on the net but they only gave me how to print current system time. Any idea guys how to make a customized date time updating every seconds in