Display hours format 24h in FullCalendar - drupal

I'm using FullCalendar in Drupal 7.
I'm trying to make a weekly calendar with available hours, I'm having problems with the 24h schedule, the hours that should be 13:00 show only 13, without the: 00, 13:20 works normally, only the: 00 does not show.
I'm using Axis format like this: H (: mm)
Attached is some images for better understanding, could anyone help me?
Problem in FullCalendar.
Config in Views of Drupal 7.

You should use
HH:mm
for a full 24-hr format.
H(:mm), which you've got now, means that
you see single digit hours in the early hours (0, 1, 2 instead of 00,
01, 02 etc ), and
the brackets indicate that the minutes should not be visible when they're zero (00).
See https://fullcalendar.io/docs/utilities/date_formatting_string and https://momentjs.com/docs/#/displaying/format for more details of the formatting strings and what options you can set.

Related

Moment js showing wrong time when i format

I'm trying to convert java datetime instant to hh:mm format using moment js
moment("2020-03-21T17:34:00Z").utcOffset(-0500).format("hh:mm")
it should give me 12:34, but somehow it is giving "12:14" which is the wrong time.
The moment js .utcOffset() method takes the offset in minutes.
so if you want to get 12:34 you need to use -300 instead of -0500
moment("2020-03-21T17:34:00Z").utcOffset(-300).format("hh:mm")
A few things:
The utcOffset function behaves differently whether you pass a string or a number. As a number, it's expected to be in terms of minutes. Since you have hours and minutes in your offset, you should pass it as a string: .utcOffset("-0500")
Format strings are case sensitive. You should use HH:mm (24-hour time), or hh:mm a (12-hour time). Since you used hh:mm without an a, anything after 12 pm will be misrepresented.
You are supplying a fixed offset. If that is your intent, then ok. But do recognize that there is a difference between an offset and a time zone. (See "Time Zone != Offset" in the timezone tag wiki.) For example, if you wanted to convert to US Eastern Time, you should use .tz('America/New_York) instead of .utcOffset("-0500"). (US Eastern time is at -4 for the date given, not -5.) You would need the moment-timezone addon to make this work.
Lastly, recognize that Moment is in maintenance mode. The moment team generally recommends Luxon for new development.

${STRFTIME(${EPOCH},,%d/%m/%y %k:%M)}

how to print/noop next 2 day date
${STRFTIME(${EPOCH},,%d/%m/%y %k:%M)}
it's displaying the current date, need to display next 2-day date.
where can change be made to get an output of next two day after date?
for ex. today 10 June need to display 12 June
EPOCH is seconds since some date(depend of linux version).
So easy way is just add to EPOCH two days in seconds (60*60*24*2)

First day of the week and the calendar week

I've to do a bit calc work and need to know how I can get the first day of the current week and the calendar week. It's for my training certificate.
Assume cell A1 contains the formula =TODAY()
The calendar week number is =WEEKNUM(A1).
Assuming Sunday is the first day of the week, the first day of the current week can be computed using =A1-WEEKDAY(A1)+1
Thanks to #Bathsheba, #AxelRichter and more.
The function depends on which language you have set in Open Office. In my OO its german so I'll let my calculation for the first and last day of a work week here:
Monday: =DATUM(JAHR(HEUTE());MONAT(HEUTE());TAGEIMMONAT(MONAT(12)) - ( TAG(HEUTE()) - WOCHENTAG(HEUTE();2)) )
Friday: =DATUM(JAHR(HEUTE());MONAT(HEUTE());TAGEIMMONAT(MONAT(12)) - ( TAG(HEUTE()) - WOCHENTAG(HEUTE();2) - 4) )
So you just have to translate into your language.
Hope this helps others too.

Issue with converting datetime to local time

I had issue with function as.POSIXlt that appears very mysterious for me. I have in data.frame over 100 000 datetimes but 3 of them didn't behave like they should and changed all datetimes when these 3 dates were included.
time=c("2008-03-30 03:07:44","2008-03-30 03:48:56","2012-03-25 03:22:20")
d=as.POSIXlt(time)
d
## [1] "2008-03-30" "2008-03-30" "2012-03-25"
but it should be:
## [1] "2008-03-30 03:07:44" "2008-03-30 03:48:56" "2012-03-25 03:22:20"
Changing minutes and seconds of these dates didn't force this function to work in right way but changing hours, days, months and years then it works fine. So the problem occurs only in combination of these certain dates and hours.
Any idea what could be the cause of such rather mysterious problem?
This is happening because of the switch from Standard Time to Daylight Saving Time. Based on your timezone (GMT+2), the switch probably took place on March 30, 2008 between 3:00 and 4:00 AM, and likewise on March 25, 2012. So anything between 3:00 and 4:00 AM never existed. R thinks it's not possible for those timestamps to exist, and defaults to the day.
I think you can get around this by setting the timezone in your POSIXlt call.

How to show time difference of hours which are greater than 24 hours?

I'm facing difficulties to show the time time difference in hours where hours are greater than 24.
Right now I'm using the following in iReport
(new SimpleDateFormat("dd':'HH':'mm':'ss")).format(new Date($V{avgDuration}.longValue()*1000))
where $V{avgDuration} is a variable in jrxml file which is the average time difference between two dates in seconds. Here it shows the 1 day 1 hour but I want it to be 25 hour. What should I do?
I've solved the problem using PeriodFormatterBuilder. But for this, I need to use joda-time library.
In the expression editor of the text box in jrxml file, just wrote the following:
new org.joda.time.format.PeriodFormatterBuilder()
.printZeroAlways()
.minimumPrintedDigits(2)
.appendHours().appendSeparator(":")
.appendMinutes().appendSeparator(":")
.appendSeconds()
.toFormatter()
.print(new org.joda.time.Period(
$V{avgDuration}.longValue()*1000))

Resources