Documentation is here
In the Umbraco master template, I have this:
<div><umbraco:Item runat="server" Field="date" formatAsDateWithTime="true" formatAsDateWithTimeSeperator="sep"></umbraco:Item></div>
which takes the field of the content page with the alias of date and return it as a string formatted as a date with time, with sep being the separator.
It should insert sep between the date and the time. But it is coming back as:
Sunday, April 13, 20142:18 PM
It should be:
Sunday, April 13, 2014sep2:18 PM
Why is it not working?
It's a typo in the documentation, separator is spelt incorrectly. The correct name is
formatAsDateWithTimeSeparator
Related
Trying to extract the date from the written string Thursday, Aug 25, 2022 2:00 PM-2:30 PM which should result in a date value of Thursday, Aug 25, 2022 2:00PM (or any date & time format).
Assuming the string is located in cell G2, I tried =TRIM(MID(G2,FIND(" ",G2),FIND(" ",G2,FIND(" ",G2)+1)-FIND(" ",G2))) and all I get is: Aug.
try:
=REGEXEXTRACT(A1, "\b[A-z]{3} \d+. \d+\b")
I am looking for a formula that will automatically convert a column of ordinal date/time values into standard date/time values.
July 1st 2022 6:48:49 pm
July 2nd 2022 10:03:35 am
July 3rd 2022 5:41:12 pm
July 4th 2022 2:44:13 pm
I need to get those reformatted to eliminate the st, nd, rd, and th portions.
Sheet
You can use
=INDEX(IF(A2:A7="",, REGEXREPLACE(A2:A7,"st|nd|rd|th","")*1))
You can then format as you like
(Do adjust the formula according to your ranges and locale)
Functions used:
INDEX
IF
REGEXREPLACE
In googlesheet, I have a timestamp in this format
March 12, 2021, 9:54 PM
I need to split it to
2021-03-12
And in another column:
9:54 PM
Is there any way to do it?
If you are using US locale for GS then use following formulas for date:
=TEXT(INDEX(SPLIT(A1,","),,{1,2}),"yyyy-MM-dd")
and for time:
=TEXT(INDEX(SPLIT(A1,","),,3),"h:mm AM/PM")
For a project I am working on I receive date and time in this format:
2015-08-16 15:00:00 UTC
yyyy-mm-dd hh-mm-ss UTC
How can I make the time display as "Saturday, August 16th 2015 at 3:30PM"? ("15:00" would be fine as well.)
And how would I make it so it checks if the date has already passed or not, so that it only displays dates that have not passed?
How would I make it so I can so that the time display as "Saturday, August 16th 2015 at 3:30PM (15:00 would be fine as well)?
Time.parse('2015-10-20 15:23 UTC').strftime('%A, %B %dth %Y at %l:%M%p')
#=> "Tuesday, October 20th 2015 at 3:23PM"
You might have to tweak it a bit to fix the suffixes (1st, 2nd, 3rd, etc)
And how would I make it so it checks if the date has already pasted or not?
You could do it like this (I'm sure there's a simpler way):
EDIT: Yes, there is a much simpler way -- check Matt's answer.
require 'time'
if Time.parse(my_date).to_i - Time.now.to_i > 0
# my_date is in the future.
end
To start, convert your string to a Time object via Time.parse(string) (APIDock).
After that you have all of the Time class to play with.
time.strftime
time.past?
I have a really big spreadsheet in google docs. I have a collumn with time in UTC format. For instance (2013, 10, 14, 12, 17) for 14 Oct 2013, 12:17 am
I want to change it to ISO 8601. I have started to change them one by one, but the data is huge. Is there any other way to do it automatic?
If you want to turn (2013, 10, 14, 12, 17) (assumed in A1) into a more conventional format:
=SPLIT(mid(A1,2,len(A1)-2),",")
to populate B1:F1 then:
=date(B1,C1,D1)+(E1+F1/60)/24
to convert to a date time index recognised by Google Sheets. The result might be formatted:
dd MMM yyyy, HH:mm AM/PM
to show: 14 Oct 2013, 12:17 PM
or formatted otherwise by choice (ISO 8601 does not require a unique format).
This does not attempt to address any strange convention for the likes of 12:17 (ie treats that as 17 minutes after noon, not after midnight) nor any time difference due to location.