Input: 1457690400000
Call: moment.unix(1457690400000).format('DD-MM-YYYY HH:mm')
Expected output: 11-03-2016 03:00
Actual output: 15-05-48162 10:00
I cannot figure out why this is happening. Is this a bug?
I think you are getting confused with the unix() method in momentjs.
Have you tried: moment(1457690400000).format('DD-MM-YYYY HH:mm ZZ') which for me outputs 11-03-2016 11:00 +0100 since I'm in CET.
Verified the result with http://www.epochconverter.com/
I found my error(s). The timestamp I am receiving is actually a string, so moment was getting confused and spitting out that wacky formatting. Furthermore, phuc77 is right in that I was using .unix() incorrectly.
Related
My preceding module in Integromat gives me an expiration date in UNIX time, which is 1640930400.
When I use the FormatDate function to convert this, I'm getting 12/31/1969 when I was expecting to get 12/31/2021. I can't seem to figure out what I'm doing wrong here. Any help would be much appreciated.
Use this instead to first parse the date and then apply the desired formatting to get the results that you want,
{{formatDate(parseDate(1.date; "X"); "MM/DD/YYYY")}}
I have a date coming through as 25/4/2022. I need it changed to 25/APRIL/2022. I have tried every combination of ?date('dd/mm/yyyy') / ?datetime('dd/mmm/yyyy') ?datetime(dd/mm/yyyy)?string('dd/mmm/yyyy') that I can think of but I keep getting teh same type of errors:
The string doesn't match the expected date/time/date-time format.
The nested reason given follows: Unparseable date: "" ---- FTL stack trace ("~" means nesting-related)
What am I missing here?
You need to use a Java SimpleDateFormat pattern to format dates. If you want the month, use M (uppercase), as m (lowercase) is minutes in hour. For a full month, use MMMM. So, use:
${"25/April/2022"?date("dd/MMMM/yyyy")}
See also:
https://freemarker.apache.org/docs/ref_builtins_string.html#ref_builtin_string_date
https://freemarker.apache.org/docs/ref_directive_setting.html#topic.dateTimeFormatSettings
How to parse month full form string using DateFormat in Java?
I am trying to understanding the date reading of ISO 8601 format and cant find a good doc to read.
If I am getting time in my code like this "2018-08-18T00:00:00+1000", is this local time or UTC time?
and when I convert it using Convert.ToDateTime("2018-08-18T00:00:00+1000"), I get the following date time {8/17/2018 7:00:00 AM}. I am not sure if that is UTC datetime or local?
What is the math behind "2018-08-18T00:00:00+1000" getting converted to {8/17/2018 7:00:00 AM}, I cant get my head around this.
You are asking for the math behind 2018-08-18T00:00:00+1000 being shown as 8/17/2018 7:00:00 AM.
First of all 8/17/2018 7:00:00 AM is just another format to display the date and time. Converted to an ISO 8601 string it would look like this: 2018-08-17T07:00:00.
+1000 at the end of the 2018-08-18T00:00:00+1000 representation is a timezone offset. You could read that string as August 18, 2018 in UTC plus ten hours. So it would be the same as 2018-08-18T10:00:00Z.
So we have a UTC date of August 18, 2018 10 AM, which is shown as a locale date of August 17, 2018 7 AM. That would mean that you are in a timezone which is 27 hours behind UTC.
A timezone behing more than 12 hours before (or 14 after) UTC does not exist (as far as I'm aware of). Therefore I assume that you have a typo in your example. Another reason could be a totally broken date parser.
But I still hope you got the math behind the conversion.
I'm working on extracting a date from a variable: "curIndex."
Here's what the code looks likes
show(txntime1 <- timestamp(mktdata[curIndex+1L])[,1])
show(txntime <- strftime(txntime1, '%Y-%m-%d %H:%M:%OS6'))
And the output is this:
"##------ Tue Mar 08 14:31:58 2016 ------##"
"NULL"
I'm working within ruleOrderProc of the quantstrat package.
The order time needs to be POSIXlt for the order book. Does anyone know what to do with this funky date format that I'm getting?
If so, thanks!
When all else fails, read the documentation. ;-) ?timestamp says:
The timestamp function writes a timestamp (or other message)
into the history and echos it to the console. On platforms that
do not support a history mechanism only the console message is
printed.
You probably meant to call time or index. Also, the time needs to be POSIXct for the order book, not POSIXlt.
Given a DateTime of
10-OCT-2015 07:10 PM
How can one convert this? I've got the first part correct but it's the Time I'm having difficulty with.
ParseDateTime([column name],"dd-MMM-yyyy hh:mm")
How can AM/PM be represented?
Figured it out!
ParseDateTime([Diary Date],"dd-MMM-yyyy hh:mm tt","en-US")