Gregorian to Hijri (Islamic) date

泪湿孤枕 提交于 2019-12-09 19:03:10
问题 Is there any way or library in Android to convert Gregorian date to Hijri(Islamic) one? I found some Java libraries such as Joda Time but I need something which works in Android. 回答1: I found this but I didn't test it yet public class DateHijri { static double gmod(double n, double m) { return ((n % m) + m) % m; } static double[] kuwaiticalendar(boolean adjust) { Calendar today = Calendar.getInstance(); int adj = 0; if (adjust) { adj = 0; } else { adj = 1; } if (adjust) { int adjustmili =

How do I get actual creation time for a file in PHP on a Mac?

对着背影说爱祢 提交于 2019-12-09 17:12:20
问题 When you choose a file in Finder and hit cmd+i on a Mac, you get the time the file was (actually) created, and the time it was last modified. My question is simply: How can I get the actual time of creation from an already existing Mac file with PHP? Now, having researched the topic, I have read posts that say it is impossible, but in my world "impossible" only means that a thing takes a bit longer to accomplish. Workarounds and hacks are welcomed. I do not want mtime or ctime related advice,

Retrieve time from MySQL as HH:MM format

白昼怎懂夜的黑 提交于 2019-12-09 17:00:52
问题 I used DATETIME datatype to store date and time in my Database. It saved date as YY-MM-DD HH:MM:SS (2012-11-06 10:45:48) I can retrieve the time from database as HH:MM:SS format but I want to retrieve it in HH:MM format. How can I do this? 回答1: Check the DATE_FORMAT Function. SELECT DATE_FORMAT(date_column, '%H:%i') FROM your_table 回答2: You will want to use DATE_FORMAT(): select date_format(yourDateColumn, '%h:%i') yourTime from yourtable See SQL Fiddle with Demo 回答3: SELECT DATE_FORMAT( NOW(

Calculate the difference between two times in python

隐身守侯 提交于 2019-12-09 16:48:35
问题 I am using python, and want to calculate the difference between two times. Actually i had scenario to calculate the difference between login and logout times, for example in organizations there is some particular limit for working hours, so if a user login at 9:00 AM in the morning and if he logs out at 6:00 PM in the evening, we need to calculate how much duration he stayed in the office(which is 9 hours in the present scenario ), but i want to do this in python, so can anyone please let me

Is there a better way to convert from UTCTime to EpochTime?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-09 16:34:01
问题 I want to set a file's modification time to the time I got from exif data. To get the time from exif, I found : Graphics.Exif.getTag :: Exif -> String -> IO (Maybe String) To set the file modification time, I found : System.Posix.Files.setFileTimes :: FilePath -> EpochTime -> EpochTime -> IO () Assuming I do find a Time in Exif, I need to convert a String to an EpochTime. With parseTime I can get a UTCTime . With utcTimeToPOSIXSeconds I can get a POSIXTime With a POSIXTime I can more or less

Format TimeSpan to mm:ss for positive and negative TimeSpans

。_饼干妹妹 提交于 2019-12-09 15:45:26
问题 I'm looking for a solution in .net 3.5 I wrote the following working solution: private string FormatTimeSpan(TimeSpan time) { return String.Format("{0}{1:00}:{2:00}", time < TimeSpan.Zero ? "-" : "", Math.Abs(time.Minutes), Math.Abs(time.Seconds)); } But my Question is: Is there a better way? Maybe something shorter where I do not need an helper function. 回答1: Somewhat shorter, using Custom TimeSpan Format Strings: private string FormatTimeSpan(TimeSpan time) { return ((time < TimeSpan.Zero)

Jquery - Validating time value on a form - correct way?

瘦欲@ 提交于 2019-12-09 15:37:51
问题 After google searching, searching this site as well as jQuery found there was no easy way to validate time value. By the looks of things it suggest using addMethod and use the to regexpess the value to check against what time should look like. However decided to look at the jquery.validate.js and how dateISO was checked, it looked lot easier way to do it, so I then copied all data relating to dateISO and called it timeISO and changed the string to validate time and used the following time

Ruby/Rails - How to convert seconds to time?

眉间皱痕 提交于 2019-12-09 15:16:14
问题 I need to perform the following conversion: 0 -> 12.00AM 1800 -> 12.30AM 3600 -> 01.00AM ... 82800 -> 11.00PM 84600 -> 11.30PM I came up with this: (0..84600).step(1800){|n| puts "#{n.to_s} #{Time.at(n).strftime("%I:%M%p")}"} which gives me the wrong time, because Time.at(n) expects n to be number of seconds from epoch: 0 -> 07:00PM 1800 -> 07:30PM 3600 -> 08:00PM ... 82800 -> 06:00PM 84600 -> 06:30PM What would be the most optimal, time zone independent solution for this transformation? 回答1:

Java Date Hibernate cut off time

…衆ロ難τιáo~ 提交于 2019-12-09 14:54:31
问题 I have a Date type column in Oracle DB and it contains date and time for sure. But when I'm trying to get data in java application it will return date with bunch of zeros instead of real time. In code it'll be like: SQLQuery sqlQuery = session.createSQLQuery("SELECT table.id, table.date FROM table"); List<Object[]> resultArray = sqlQuery.list(); Date date = (Date)resultArray[1]; If it was 26-feb-2010 17:59:16 in DB I'll get 26-feb-2010 00:00:00 How to get it with time? 回答1: I am not an expert

rough estimate of the time offset from GMT from latitude longitude

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 14:51:23
问题 Is there a way to estimate the offset from GMT (or time zone) from a latitude/longitude? I've seen geonames, but this would need to work long term and we don't really want to rely on a web service. It'd just be used for determining whether to display "today" or "tonight" when giving information to various users so it wouldn't need to be too accurate (an hour or two off wouldn't be bad). 回答1: offset = direction * longitude * 24 / 360 where direction is 1 for east, -1 for west, and longitude is