While answering Regexp matching ISO8601 date/time format I wondered how you express first coming Monday or repeat every monday in ISO8601.
My guess would be something like:
W-1
R/W-1
But I cannot find a confirmation of that.
ISO 8601 has the concept of week dates which allow you to specify a week of the year and the day of the year. In the following example 2014-W01-1 means the first week of 2014 on Monday. Then repeat that every week using P1W
R/2014-W01-1T00:00:00/P1W
Seen in this answer
I have problem understanding the following date formate from apiblueprint tutorial
2016-02-05T08:40:51.620Z
I now 2016 is the year 02 is the month 05 is the date and 08:40:51 is the time but I dont understand the last part .620Z.
Can some one explain it for me. I wanted to find out AM or PM of the time using javascript from the date using javascript and not sure whether the formate is 12 or 24 hours.
Thanks
First of all, API Blueprint doesn't require you to use any particular Date format; you are free to use whatever you want to.
The format used in the tutorial is the standard ISO 8601 format: .620 is the number of miliseconds, and Z designates a Zulu timezone, meaning UTC.
Is it possible to insert a date before 1970? I know, we life in an UNIX world but i need an workaround for my problem.
Thanks in advance!
Timestamps pre-1970 in typo3 are negative.
Any date on or before September 1752 is not supported though due to the switch from Julian to Gregorian. If you need to go that far back then you're out of luck.
I need to calculate mean sales for sunday. Values for the column salesdate(timestamp) are:
2012-01-01 09:00:00
2012-01-01 09:00:00
2012-01-01 09:00:00
...........
I have extracted the date part using to_date().Now how to get weekday(like sunday) from this date in hive?
Please guide.
You can use a combination of unix_timestamp, and from_unixtime UDFs.
from_unixtime(unix_timestamp(col), 'EEEE')
If you check the documentation for SimpleDateFormat, which from_unixtime uses, you can see that "EEEE" is the code for the full name of the day of the week. "EEE" gets you the abbreviated version, i.e. "Sun" or "Mon".
There is no OOTB feature to achieve this as of now. A ticket is open though.
You need to write a UDF for this. Or, you could also try the patch available with the above mentioned ticket.
HTH
In Hive you can also use the below method to solve this problem in very elegant way and its performance is very good.
from_unixtime accepts the 1st argument in int format:
date_format(from_unixtime(col(timestampinseconds),'yyyy-MM-dd'),'EEEE')
You can also test it like this:
select date_format(from_unixtime(1531372789,'yyyy-MM-dd'),'EEEE');
Output:
Thursday
I hope it serves your purpose.
Just a suggestion.. you can take a low date (lower than the minimum date in your data), which is a Sunday, in 'yyyy-mm-dd' format. Use DATEDIFF() function to find the difference between the date value in your data (in 'yyyy-mm-dd' format) and this low date. Calculate modulo 7 of the datediff output. This will be 0 for Sunday, 1 for Monday, and so on..
select extract(dayofweek from from_unixtime(unix_timestamp));
Gregorian date comparison in crystal report. For example, if {#WO due date}< 7/18/2013 then XXX else XXX
When I check if there is an error, the system shows me that the "7/18/2013" is not a date, but I don't know what is the right format for the gregorian date for comparison. Would someone help me on this?
Thanks!
if {#WO due date}< datea(7/18/2013)