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

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)

Related

seconds since date to date in R

I have a dataset file with a time variable in "seconds since 1981-01-01 00:00:00". What I need is to convert this time into calendar date (YYYY-MM-DD HH:mm:ss). I've seen a lot of different ways to do this for time since epoch (1970) (timestamp, calendar.timegm, etc) but I'm failing to do this with a different reference date.
One option is to simply add 347133600s (11 years) to each value in seconds. this will then allow you to simply use conversion as it would be from 1970-01-01.

DateTime in Unity as a very large number

I'm trying to understand a saved game file format.
The game is written with Unity.(not sure that it's related)
The file is a JSON file and the timestamp is:
"Timestamp": 637015624965194930,
This translates to Aug 16th 2019 at 14:28
another example is:
"Timestamp": 637014628610503310,
This translates to Aug 15th 2019 at 10:47
I figured that subtracting the 2 numbers will give me the difference and it kind of works.
It seems that the time is measured in 1/10000000 of a second.
Can anyone figure out how to convert this to EPOCH time?
This time is 1/10000000 of a second since Jan 1st 0001
It is the standard time format used by .NET
so you can subtract 621355968000000000 (Jan 1st 1970) and divide by 10000000 to get seconds since EPOCH.

how to convert days in decimal number to actual days using Moment.js

I want to show in my html page like:
var days = 187.89808080;
<div>
<span>Showing last {days} days</span>
</div>
its displaying:
Showing last 187.89808080 days, instead is there a way in moment.js i can convert those days into months, for ex: 187 days equivalent to 6 months?
thanks
If you want only the number of days, then only round down the number, you don't need a complex library for that.
parseInt(days)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt#Syntax

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