User Manual
Print

Checking Whether DateTimeOffsets are the Same

dateTimeOffset =

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>dateTimeOffset</variable><variable>currentTime</variable><variable>duration</variable></variables><block type=\"DateTime_DateTimeOffset_equals\" disabled=\"true\" x=\"-112\" y=\"248\"><value name=\"dateTimeOffset\"><block type=\"variables_get\" disabled=\"true\"><field name=\"VAR\">dateTimeOffset</field></block></value></block></xml>"}
				
			

This block is used to check whether two DateTimeOffsets are the same.

Parameters: DateTimeOffset

Output: Boolean (True/False)

Sample code:

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>dateTimeOffset</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">dateTimeOffset</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"DateTime_createDateTimeOffset\"><mutation xmlns=\"http://www.w3.org/1999/xhtml\" _expanded=\"0\" _input_init=\"false\"></mutation><value name=\"year\"><shadow type=\"math_number\"><field name=\"NUM\">2020</field></shadow></value></block></value><next><block type=\"controls_if\"><mutation else=\"1\"/><value name=\"IF0\"><shadow type=\"logic_boolean\"><field name=\"BOOL\">TRUE</field></shadow><block type=\"DateTime_DateTimeOffset_equals\"><value name=\"dateTimeOffset\"><block type=\"variables_get\"><field name=\"VAR\">dateTimeOffset</field></block></value><value name=\"other\"><block type=\"DateTime_parseDateTimeOffset\"><value name=\"s\"><shadow type=\"text\"><field name=\"TEXT\">2020</field></shadow></value></block></value></block></value><statement name=\"DO0\"><block type=\"basic_consoleLogText\"><value name=\"text\"><block type=\"typescript_expression\"><field name=\"EXPRESSION\">\"Both of them are the same.\"</field></block></value></block></statement><statement name=\"ELSE\"><block type=\"basic_consoleLogText\"><value name=\"text\"><block type=\"typescript_expression\"><field name=\"EXPRESSION\">\"They are different.\"</field></block></value></block></statement></block></next></block></statement></block></xml>"}
				
			

The output:

dateTimeOffset= - Output