I am trying to get the current hour of the day using date: "%H" in a set variables widget. I do the this first on day of month (date: "%d") which works okay, but the hour doesn't appear to return any value, any suggestions?
Basically, trying to compensate for the time difference in UK and US, using 'now'.
From your screenshot I can see one use of %H in which you set a time_zone variable to {{ 'now' | date: " %H %M " }}. I can then see you are comparing that time_zone variable as a time.
When you compare as a time in Studio you need to provide the time in the form "HH:MM", but it seems you have it in the format " HH MM ".
Try setting the variable to be {{ 'now' | date: "%H:%M" }} and see if things work.
Related
I'm trying to run the run command with some custom values:
dbt run --vars "{start_date: '2022-08-01', end_date: '2022-08-02'}"
and then use these variables in contexts like:
WHERE session_date BETWEEN {{ var('start_date') }} AND {{ var('end_date') }}
The values need to be inserted as strings (with single quotes kept), but it gets compiled as:
WHERE session_date BETWEEN 2022-08-01 AND 2022-08-02
which then is incorrect SQL ("No matching signature for operator BETWEEN for argument types: DATE, INT64, INT64"). I have tried switching the single and double quotes, but the problem remains.
How can I make it respect the quotes passed in the YAML dict?
I solved this by simply adding single quotes around the variable statements:
WHERE session_date BETWEEN '{{ var("start_date") }}' AND '{{ var("end_date") }}'
Try the postgresql TO_DATE function to convert your input string variable to a datetime variable for easier comparison.
E.g)
WHERE session_date BETWEEN to_date({{ var('start_date') }}) AND to_date({{ var('end_date') }})
When I use server.log or request.log I see two numbers appear at the beginning of each line, what exactly are these two numbers?
server.log(['info'], 'hello world');
Output:
151230/205853.557, [log,info], data: hello world
I'm assuming this is a process id and a timestamp? "151230/205853.557" How do I interpret these numbers?
This is the default Date/Time output format of the GoodConsole reporter for Good.
It can be changed by setting the format option:
From the docs:
format - MomentJS format string. Defaults to 'YYMMDD/HHmmss.SSS'.
So 151230/205853.557 means 30th December 2015 at 20:58:33 and 557ms.
I created a form in html and the data is consumed and sent via PHP. The email sends fine but the format is wrong inside the email. For example the date has three variables "pick_up_date", pick_up_date_2" and pick_up_date_3".
These are month, day and year. I want it to display 02 21 2014 but it displays 02212014. Below is the code I used in PHP but did not work. Any help would be greatly appreciated.
$email_message .= "Pick Up Date: ".clean_string($pick_up_date). "". ($pick_up_date_2). "". ($pick_up_date_3)."\n";
Put spaces in between the "".
$email_message .= "Pick Up Date: ".clean_string($pick_up_date). " ". ($pick_up_date_2). " ". ($pick_up_date_3)."\n";
Within Orchard CMS (version 1.6) I have a Query that displays a DateTime property called StartDate. When setting it up I chose the "Full date/time pattern (short time)" as the Date format, and then I was rewriting the output as follows:
<My html text here> {Text}
This would render as "My html text here Saturday, April 13, 2013 2:30 PM".
I realized that for users on a different time zone, the date/time was being converted automatically and instead of displaying 2:30 PM (server is at PST), it was displaying 5:30 PM (user was at EST).
Following Bertrand Le Roy's solution here, it worked out nice with one minor issue.
Now my code is this:
<My html text here> {Content.Fields.MyContentType.MyDateTimeField.DateTime.Local}
And here is the result: "My html text here 4/13/2013 2:30:00 PM".
The formatting is not the one I would rather use.
Does anyone know how can I format this to the Full date/time pattern (short time)?
Thank you in advance.
{Content.Fields.MyContentType.MyDateTimeField.DateTime.Local.Format:dddd, MMMM d, yyyy h:mm tt} should do the trick.
I've read through a lot of examples, but the problem I'm facing is the date I'm getting doesn't have leading 0's and all the objective-c stuff I've found has them. So I need to take the date:
4/9/2012 1:30 PM
And determine if it is today. My place was to either grab today's date and compare it to the first part of that string, but as I said before I can't find anyway to make a date in objective c without leading 0's. I'm hoping to avoid parsing that string manually to add leading 0's.
Use an NSDateFormatter object
[dateFormatter setDateFormat:#"h:mm a"];
if you want 0's
[dateFormatter setDateFormat:#"hh:mm a"];
I think that using the single M option for your date format string will allow it to parse a single digit month value:
The possible date formats are specified here
#ynistersix answer is correct. In Data Formatting Guide, they said that NSDateFormatter follows http://unicode.org/reports/tr35/tr35-dates.html
h 1..2 11 Hour [1-12]. When used in skeleton data or in a skeleton
passed in an API for flexible date pattern generation, it should match
the 12-hour-cycle format preferred by the locale (h or K); it should
not match a 24-hour-cycle format (H or k). Use hh for zero padding.
This is consistent with most other languages. Like .NET
"h" The hour, using a 12-hour clock from 1 to 12.
2009-06-15T01:45:30 -> 1
2009-06-15T13:45:30 -> 1
"hh" The hour, using a 12-hour clock from 01 to 12.
2009-06-15T01:45:30 -> 01
2009-06-15T13:45:30 -> 01