Date manipulation: Difference between revisions

Content added Content deleted
Line 1,308: Line 1,308:


{{FormulaeEntry|page=https://formulae.org/?timeZone=America%2FNew_York&script=examples/Date_manipulation}}
{{FormulaeEntry|page=https://formulae.org/?timeZone=America%2FNew_York&script=examples/Date_manipulation}}

'''Solution'''

'''Creating the initial time.''' Fōrmulæ can create a time in any time zone, however, it always displays them in the current timezone. In order to cause no confusion, in this example the current time zone has been set as America/New_York, which is EST.

[[File:Fōrmulæ - Date manipulation 01.png]]

[[File:Fōrmulæ - Date manipulation 02.png]]

'''Adding 12 hours.''' It is achieved adding to the time expression the desired number of milliseconds.

[[File:Fōrmulæ - Date manipulation 03.png]]

[[File:Fōrmulæ - Date manipulation 04.png]]

This is not a bug, the daylight saving time (in the America/New_York time zone), for 2009 started March 8 at 2:00 hrs, at which time clock is adjusted 1 hour later. It occurred between the 12 hour addition of our example. See [https://www.timeanddate.com/time/change/usa/new-york?year=2009 this page].

Note the ☀ symbol, indicating that the time is in daylight saving time (at the current time zone).

'''Showing results for other time zones.''' As it was said before, a time is always shown in current time zone, but a time can be formatted to different time zones.

If no time zone is specified, current time zone is used:

[[File:Fōrmulæ - Date manipulation 05.png]]

[[File:Fōrmulæ - Date manipulation 06.png]]

[[File:Fōrmulæ - Date manipulation 07.png]]

[[File:Fōrmulæ - Date manipulation 08.png]]

Let us use a different time zone:

[[File:Fōrmulæ - Date manipulation 09.png]]

[[File:Fōrmulæ - Date manipulation 10.png]]

[[File:Fōrmulæ - Date manipulation 11.png]]

[[File:Fōrmulæ - Date manipulation 12.png]]

Beside the time zone, a different locale can also be specified, in order to format the result in such that locale:

[[File:Fōrmulæ - Date manipulation 13.png]]

[[File:Fōrmulæ - Date manipulation 14.png]]

The components of a time expression can be obtained individually, even for a specific time zone:

[[File:Fōrmulæ - Date manipulation 15.png]]

[[File:Fōrmulæ - Date manipulation 16.png]]


=={{header|FutureBasic}}==
=={{header|FutureBasic}}==