User Manual
Print

Combining a New Offset with DateTimeOffset

Convert DateTimeOffsest with offset

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>dateTimeOffset</variable></variables><block type=\"DateTime_DateTimeOffset_convertOffset\" disabled=\"true\" x=\"-22\" y=\"382\"><value name=\"dateTimeOffset\"><block type=\"variables_get\" disabled=\"true\"><field name=\"VAR\">dateTimeOffset</field></block></value><value name=\"offset\"><shadow type=\"text\" disabled=\"true\"><field name=\"TEXT\">+00:00</field></shadow></value></block></xml>"}
				
			

This block is used to combine the DateTimeOffset with the new offset.

Parameters: 

      • DateTimeOffset
      • String

Output: DateTimeOffset

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_now\"/></value><next><block type=\"basic_consoleLogText\"><value name=\"text\"><block type=\"DateTime_DateTimeOffset_toString\"><value name=\"dateTimeOffset\"><block type=\"DateTime_DateTimeOffset_convertOffset\"><value name=\"dateTimeOffset\"><block type=\"variables_get\"><field name=\"VAR\">dateTimeOffset</field></block></value><value name=\"offset\"><shadow type=\"text\"><field name=\"TEXT\">+08:00</field></shadow></value></block></value></block></value></block></next></block></statement></block></xml>"}
				
			

The output:

Convert DateTimeOffsest with offset - Output