time-format

<p:schedule> wrong timeFormat with PrimeFaces 5.0

不羁岁月 提交于 2019-12-11 09:41:16
问题 I upgraded my PrimeFaces version 4.0 to 5.0 and now the timeFormat in my <p:schedule> is not correct. In 4.0, each event in the calendar had this timeFormat : 3:00 - 5:00 . For this I have timeFormat="HH:mm{ - HH:mm}" I don't change anything and then, with 5.0, I have 3:00 - . Moreover the start date and end date are not corrects too. I have two hours less than expected. Anyone else have this issues ? 回答1: I have just tried your timeFormat and it works for me! For set up correctly start date,

Time formatting using SimpleDateFormat in java

寵の児 提交于 2019-12-10 20:44:55
问题 My requirement is to display date on webpage in hh:mm format. But, it should not display zero before the hour value if it is a 1-digit number. For example - It should be displayed as : 11:30 AM, 9:15 AM, 1:00 PM. I tried to resolve this but the only issue coming here is in removing the extra 0 from the 1-digit hour value. Input time is in format - hh:mm:ss . The date value is a string initially. It is parsed as date in below format first of all- final SimpleDateFormat dfParse = new

Is there a CPAN module for converting seconds to English?

会有一股神秘感。 提交于 2019-12-10 15:04:30
问题 Is there a CPAN module that can convert a number of seconds to a human-readable English description of the interval? secToEng( 125 ); # => 2 min 5 sec secToEng( 129_600 ); # => 1 day 12 h The format isn't important as long as it's human-readable. I know that it would be trivial to implement. 回答1: Since Perl v5.9.5, the modules Time::Seconds and Time::Piece are part of the core Perl distribution. So you can use them without installing additional modules. perl -MTime::Seconds -e 'my $s=125; my

Django Admin DateTimeField Showing 24hr format time

邮差的信 提交于 2019-12-08 17:17:09
问题 I tried on google but I did not found the solution. In Django admin side, I'm displaying start date and end date with time. But time is in 24 hr format and I want to display it in 12 hr format class CompanyEvent(models.Model): title = models.CharField(max_length=255) date_start = models.DateTimeField('Start Date') date_end = models.DateTimeField('End Date') notes = models.CharField(max_length=255) class Meta: verbose_name = u'Company Event' verbose_name_plural = u'Company Events' def _

24-hour format to 12-hour format

佐手、 提交于 2019-12-08 16:02:40
问题 I have problem with converting 24-hour format to 12 hour format. This is my code. private TimePickerDialog.OnTimeSetListener mTimeSetListener = new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { // TODO Auto-generated method stub ViewGroup vg=(ViewGroup) view.getChildAt(0); hour = hourOfDay; minutes = minute; String am_pm = (hourOfDay < 12) ? "AM" : "PM"; SimpleDateFormat sdf = new SimpleDateFormat("hh:mm a",Locale.US);

I18n localization time format for spanish translation

半城伤御伤魂 提交于 2019-12-08 11:29:54
问题 I am using I18n for localizing a rails application, and i came across a situation which involves time format using I18n. the date and time format displaying is as follows: "Tuesday, July 11, 2017" for time : 2017-07-11 12:30:00 +0530 for localizing i am using en.yml and es.yml with both time formats as shown below: en: time: formats: long: '%A, %B %d, %Y' short: '%b %d, %Y' and in model i am using I18n.l(raw_date.to_time, format: :long) , this working fine for english with result "Tuesday,

How to convert Youtube API V3 duration in Java

£可爱£侵袭症+ 提交于 2019-12-03 15:22:59
问题 The Youtube V3 API uses ISO8601 time format to describe the duration of videos. Something likes "PT1M13S". And now I want to convert the string to the number of seconds (for example 73 in this case). Is there any Java library can help me easily do the task under Java 6? Or I have to do the regex task by myself? Edit Finally I accept the answer from @Joachim Sauer The sample code with Joda is as below. PeriodFormatter formatter = ISOPeriodFormat.standard(); Period p = formatter.parsePeriod(

How to convert Youtube API V3 duration in Java

旧街凉风 提交于 2019-12-03 05:52:29
The Youtube V3 API uses ISO8601 time format to describe the duration of videos. Something likes "PT1M13S". And now I want to convert the string to the number of seconds (for example 73 in this case). Is there any Java library can help me easily do the task under Java 6? Or I have to do the regex task by myself? Edit Finally I accept the answer from @Joachim Sauer The sample code with Joda is as below. PeriodFormatter formatter = ISOPeriodFormat.standard(); Period p = formatter.parsePeriod("PT1H1M13S"); Seconds s = p.toStandardSeconds(); System.out.println(s.getSeconds()); Joda Time is the go

PHP Timestamp into DateTime

…衆ロ難τιáo~ 提交于 2019-12-02 17:48:45
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 the same date. You don't need to turn the string into a timestamp in order to create the DateTime

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

巧了我就是萌 提交于 2019-12-01 10:29:58
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. Did you try this ? SimpleDateFormat dateFromat= new SimpleDateFormat("MM/dd/yyyy hh:mm aa"); Date today = new Date();