julian-date

C# Julian Date Parser

我怕爱的太早我们不能终老 提交于 2019-12-14 02:21:00
问题 I have a cell in a spreadsheet that is a date object in Excel but becomes a double (something like 39820.0 for 1/7/2009) when it comes out of C1's xls class. I read this is a Julian date format. Can someone tell me how to parse it back into a DateTime in C#? Update: It looks like I might not have a Julian date, but instead the number of days since Dec 30, 1899. 回答1: I think Excel is just using the standard OLE Automation DATE type which can be converted with the DateTime.FromOADate method.

Convert Julian Date with Time (H/m/s) to Date Time in C#

雨燕双飞 提交于 2019-12-13 12:15:19
问题 How can I convert a Julian Date with Time - e.g. 2456961.090914 (CE 2014 October 30 14:10:54.6 UT) as you can test on this website: http://aa.usno.navy.mil/data/docs/JulianDate.php in C#? I tried several algorithms I found on the net, but some don't contemplate the Julian as a double , only long or even int . Some other use DateTime.ToOADate that I do not have in the System.DateTime . How can I convert the given Julian Date to a normal/regular DateTime? 回答1: Thanks to Mr. Zator answer here I

Convert 7 digit Julian Date to DateTime in SQL?

时光怂恿深爱的人放手 提交于 2019-12-12 03:55:41
问题 I have seen numerous examples on the web and a few here on SO. However, none seem to work for my data. Here are a few julian dates with their known converted values. JUL | DateTime 2454522 | 2008-02-25 00:00:00.000 2454571 | 2008-04-14 00:00:00.000 2455713 | 2011-05-31 00:00:00.000 I have tried this which does not work: DECLARE @JD int = 2454522 SELECT DATEADD(YEAR, @JD / 1000 - 1900, @JD % 1000 - 1) It gives me this: 2455-06-06 00:00:00.000 which is obviously wrong. What am I missing here?

Convert date without year into Julian day (number of days since start of the year)

三世轮回 提交于 2019-12-12 03:45:31
问题 I have some date that I need to convert into Julian days. This is the data I have date <- c("21-Jul", "14-Jul", "08-Jul", "08-Jul","16-Jul") class(date) [1] "character" I want to convert date into julian days. So for the above dates, the Julian days will be: date 202,195,189,189,197 I found a function as.POSIXlt that converts date into Julian day. For e.g. tmp <- as.POSIXlt("16Jun10", format = "%d%b%y") tmp$yday # [1] 166 But this needs date in a particular order including year which I do not

Map iso8601 date time string to Julian Day using javascript

不想你离开。 提交于 2019-12-11 07:16:18
问题 Does anyone have a compact / elegant map from an ISO-8601 date time string of the following form: 2013-12-28T20:30:00-0700 To a Julian day. I'm hoping to find a solution that avoids an external library and has minimal regex and string manipulation. 回答1: Here’s one way to do it. You can convert an ISO string—with a time zone offset too—to a JavaScript Date object in modern JavaScript (ES5). This works in Node.js, Chrome and Firefox. It is not yet supported in Safari or IE. If you need it to

Julian date to regular date conversion

落花浮王杯 提交于 2019-12-11 05:16:51
问题 How do i convert a julian date 2456606 which stands for Nov 18 2013 to the string format 18/11/2013 using java APIs? I tried executing the below code but it is not giving me the right answer. Any corrections to the below code are welcome String j = "2456606"; Date date = new SimpleDateFormat("yyyyD").parse(j); String g = new SimpleDateFormat("dd.MM.yyyy").format(date); System.out.println(g); 回答1: The Julian date for Nov 18 2013 is "2013322" . The number you used, "2456606" , would be the

Converting Julian date to Java date but still cannot get Month

限于喜欢 提交于 2019-12-11 01:47:45
问题 I am trying to get day ,month and year from a Julian date. String date = "13136";//Julian date Date convertedDate = new SimpleDateFormat("yyDDD").parse(date); System.out.println(convertedDate); It prints Thu May 16 00:00:00 BST 2013 which is correct. Now I want to get Day , Month and Year from it Calendar cal = Calendar.getInstance(); cal.setTime(convertedDate); System.out.println(cal.get(Calendar.MONTH)); It prints 4 . It should print 5 instead of 4 . Why is it not printing as correct ? What

Julian Date Conversion

守給你的承諾、 提交于 2019-12-10 11:19:17
问题 Sample Julian Dates: 2009218 2009225 2009243 How do I convert them into a regular date? I tried converting them using online converter and I got- 12-13-7359 for 2009225!! Makes no sense! 回答1: Use the Joda-Time library and do something like this: String dateStr = "2009218"; MutableDateTime mdt = new MutableDateTime(); mdt.setYear(Integer.parseInt(dateStr.subString(0,3))); mdt.setDayOfYear(Integer.parseInt(dateStr.subString(4))); Date parsedDate = mdt.toDate(); Using the Java API: String

Using the Ruby Date class for Astronomical data

早过忘川 提交于 2019-12-08 02:54:20
问题 ~ Approximate Solar Noon lw = 88.743 # my longitude jdate = Date.ordinal_to_jd(Time.now.year, Time.now.yday) n = (jdate - 2451545 - 0.0009 - lw / 360).round # lw is users longitude west of 0. j_noon = 2451545 + 0.0009 + lw / 360 + n puts j_noon => 2455616.24740833 As an update, part of the confusion would be that solar noon is where all calculations started since January 1, 4713 BC Greenwich noon. The correct use of Date.ordinal_to_jd has not compensated for this fact. So by adding or

Julian Date Conversion

不羁岁月 提交于 2019-12-06 11:06:14
Sample Julian Dates: 2009218 2009225 2009243 How do I convert them into a regular date? I tried converting them using online converter and I got- 12-13-7359 for 2009225!! Makes no sense! Use the Joda-Time library and do something like this: String dateStr = "2009218"; MutableDateTime mdt = new MutableDateTime(); mdt.setYear(Integer.parseInt(dateStr.subString(0,3))); mdt.setDayOfYear(Integer.parseInt(dateStr.subString(4))); Date parsedDate = mdt.toDate(); Using the Java API: String dateStr = "2009218"; Calendar cal = new GregorianCalendar(); cal.set(Calendar.YEAR,Integer.parseInt(dateStr