time-format

How can I change date from 24-hours format to 12-hours format (am/pm) in android

半世苍凉 提交于 2019-12-01 09:24:01
问题 Calendar ci = Calendar.getInstance(); CiDateTime = "" + (ci.get(Calendar.MONTH) + 1) + "/" + ci.get(Calendar.DAY_OF_MONTH) + "/" + ci.get(Calendar.YEAR); String visitdatetime = CiDateTime + "" + ci.get(Calendar.HOUR_OF_DAY) + ":" + ci.get(Calendar.MINUTE) + ":" + ci.get(Calendar.SECOND); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm a"); I am getting from the server in 24 hours format.but want to show my date like MM/dd/yyyy hh:mm AM/PM like 12 hrs format. 回答1: Did you try

PHP Timestamp into DateTime

霸气de小男生 提交于 2019-11-30 11:11:07
问题 Do you know how I can convert this to a strtotime, or a similar type of value to pass into the DateTime object? The date I have: Mon, 12 Dec 2011 21:17:52 +0000 What I've tried: $time = substr($item->pubDate, -14); $date = substr($item->pubDate, 0, strlen($time)); $dtm = new DateTime(strtotime($time)); $dtm->setTimezone(new DateTimeZone(ADMIN_TIMEZONE)); $date = $dtm->format('D, M dS'); $time = $dtm->format('g:i a'); The above is not correct. If I loop through a lot of different dates its all

Convert ISO 8601 to unixtimestamp

99封情书 提交于 2019-11-30 05:42:07
How can I convert 2012-01-18T11:45:00+01:00 (ISO 8601) to 1326883500 (unixtimestamp) in PHP? echo date("U",strtotime('2012-01-18T11:45:00+01:00')); To convert from ISO 8601 to unixtimestamp : strtotime('2012-01-18T11:45:00+01:00'); // Output : 1326883500 To convert from unixtimestamp to ISO 8601 (timezone server) : date_format(date_timestamp_set(new DateTime(), 1326883500), 'c'); // Output : 2012-01-18T11:45:00+01:00 To convert from unixtimestamp to ISO 8601 (GMT) : date_format(date_create('@'. 1326883500), 'c') . "\n"; // Output : 2012-01-18T10:45:00+00:00 To convert from unixtimestamp to ISO

Convert ISO 8601 to unixtimestamp

不想你离开。 提交于 2019-11-29 04:51:40
问题 How can I convert 2012-01-18T11:45:00+01:00 (ISO 8601) to 1326883500 (unixtimestamp) in PHP? 回答1: echo date("U",strtotime('2012-01-18T11:45:00+01:00')); 回答2: To convert from ISO 8601 to unixtimestamp : strtotime('2012-01-18T11:45:00+01:00'); // Output : 1326883500 To convert from unixtimestamp to ISO 8601 (timezone server) : date_format(date_timestamp_set(new DateTime(), 1326883500), 'c'); // Output : 2012-01-18T11:45:00+01:00 To convert from unixtimestamp to ISO 8601 (GMT) : date_format(date

How do I format an amount of milliseconds into minutes:seconds:milliseconds in PHP?

你说的曾经没有我的故事 提交于 2019-11-28 23:29:58
I have a total ammount of milliseconds (ie 70370) and I want to display it as minutes:seconds:milliseconds ie 00:00:0000. How can I do this in PHP? Don't fall into the trap of using date functions for this! What you have here is a time interval, not a date. The naive approach is to do something like this: date("h:i:s.u", $mytime / 1000) but because the date function is used for (gasp!) dates, it doesn't handle time the way you would want it to in this situation - it takes timezones and daylight savings, etc, into account when formatting a date/time. Instead, you will probably just want to do

Format realtime stopwatch timer to the hundredth using Swift

前提是你 提交于 2019-11-28 13:46:22
I have an app using an NSTimer at centisecond (0.01 second) update intervals to display a running stopwatch in String Format as 00:00.00 (mm:ss.SS). (Basically cloning the iOS built-in stopwatch to integrate into realtime sports timing math problems, possibly needing millisecond accuracy in the future) I use (misuse?) the NSTimer to force-update the UILabel. If the user presses Start, this is the NSTimer code used to start repeating the function: displayOnlyTimer = NSTimer.scheduledTimerWithTimeInterval(0.01, target: self, selector: Selector("display"), userInfo: nil, repeats: true) And here

Meaning of Oracle's dump(systimestamp) bytes

萝らか妹 提交于 2019-11-28 12:33:53
I'm trying to understand what the bytes from the timestamp set on my DB mean. How do they get computed to generate the more readable date? I'm using the below query to get the data that I need: SELECT systimestamp ,DUMP (systimestamp) ,sessiontimezone FROM dual; And the output of my above query is: +-------------------------------------+-----------------------------------------------------------------+------------------+ | systimestamp | dump(systimestamp) | sessiontimezone | +-------------------------------------+-----------------------------------------------------------------+--------------

Converting a time decimal/fraction representing days to its actual time in R? [duplicate]

淺唱寂寞╮ 提交于 2019-11-28 10:16:53
问题 This question already has an answer here: Convert a decimal number to HH:MM 3 answers I have a column in R on my dataset with values that have been converted into what I believe is a time decimal fraction based on days . I have been using this site as a reference: http://www.calculatorsoup.com/calculators/time/decimal-to-time-calculator.php Which converting 0.3408565 days corresponds to the time of 8:10:50 by doing the following: 0.3408565 * 24 hours/day = 8.180555544 = 8 hours 0.180555544 *

Show Time in 12 and 24 hour format in UIDatepicker on the basis of app settings not on device Settings

随声附和 提交于 2019-11-27 20:06:47
My problem is there is a switch in my app which toggles for 12 hour and 24 hour time format.I am displaying my labels time according to that, but the UIDatePicker time is not getting changed.It's time is depending on device time settings format.Is it possible to show time in UIDatePicker according to my app settings which might be different from device time settings. Somewhere I read that UIDatePicker respects only device settings but still I want to ask if it is possible to show time in 12 and 24 hour format in UIDatePicker based on my app settings. Please help me. Any suggestions would be

How do I format an amount of milliseconds into minutes:seconds:milliseconds in PHP?

白昼怎懂夜的黑 提交于 2019-11-27 14:45:57
问题 I have a total ammount of milliseconds (ie 70370) and I want to display it as minutes:seconds:milliseconds ie 00:00:0000. How can I do this in PHP? 回答1: Don't fall into the trap of using date functions for this! What you have here is a time interval, not a date. The naive approach is to do something like this: date("H:i:s.u", $milliseconds / 1000) but because the date function is used for (gasp!) dates, it doesn't handle time the way you would want it to in this situation - it takes timezones