Documentation

Una is developed by Una Technologies Limited

All rights reserved

© 2022 Una Technologies Limited

Print

Modifying Offset

Set the offset of dateTimeOffset to

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>dateTimeOffset</variable></variables><block type=\"DateTime_DateTimeOffset_setOffset\" disabled=\"true\" x=\"-22\" y=\"472\"><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 set the new offset with the original DateTimeOffset. 

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

The output:

Set the offset of dateTimeOffset to - Output
Previous Combining a New Offset with DateTimeOffset
Next Changing the Format of DateTimeOffset to Text Format