The Google Earth Plugin accepts time data in two ways:
Once time has been introduced into a plugin instance through either of the above methods, a time slider is displayed. This slider can be manipulated by the end user to control the point in time, or range of times, being displayed.
There are no time-related functions in the Earth API. Time information (other than enabling the Sun display mode) must be imported from a KML file.
When sunlight is activated in the plugin, the user's computer clock time is used to display the Sun's correct position and shadows on the terrain. A time slider is added to the plugin window, allowing the user to change the time being displayed.
ge.getSun().setVisibility(true);

The position of the sun can also be controlled by time-tagged KML, as described below.
There are two concepts of time that are important with regards to the plugin: a feature's time, and a view's time. Basically:
Time information is specified with KML; the Earth API does not provide a method of passing time information. The examples in this document display the KML markup only; for information on importing KML into the plugin, refer to the KML chapter of the Developer's Guide. More information about KML is available from the KML documentation.
Time information can be attached to a feature, to define the time or times at which that feature should be viewable on the globe.
For example, a placemark named PM2009+ can be created, containing time information as follows:
<Placemark>
<name>PM2009+</name>
<TimeSpan>
<begin>2009-01-01</begin>
</TimeSpan>
<Point>
<coordinates>-122.448425,37.802907,0</coordinates>
</Point>
</Placemark>
This TimeSpan contains only a <begin> tag, because it should exist for all dates from January 1st, 2009 onwards. This placemark is visible:
Time can be attached to a view (a Camera or a LookAt) to specify the point in time from which the viewer is looking at the globe. The time can be a single point in time (TimeStamp) or a range (TimeSpan).
<Camera>
<gx:TimeStamp>
<when>2009-01-01T17:00:00-08:00</when>
</gx:TimeStamp>
<longitude>-122.444633</longitude>
<latitude>37.801899</latitude>
<altitude>139.629438</altitude>
<heading>-70.0</heading>
<tilt>75</tilt>
</Camera>
This view shows the specified geographic location, with features present at the specified hour on January 1st, 2009. If sun is activated, it is displayed at the correct height in the sky, and shadows are drawn accordingly. The view in this example includes the sample placemark (PM2009+) we looked at earlier.
However, if <Camera> is edited to change the time to January 1st, 2008, placemark PM2009+ is not displayed.
<Camera>
<gx:TimeStamp>
<when>2008-01-01T17:00:00-08:00</when>
</gx:TimeStamp>
<longitude>-122.444633</longitude>
<latitude>37.801899</latitude>
<altitude>139.629438</altitude>
<heading>-70.0</heading>
<tilt>75</tilt>
</Camera>
Once a time has been specified in the KML, that time remains set until another time is specified. There is no way to clear the time selection.

Source:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:gx="http://www.google.com/kml/ext/2.2">
<Document>
<Camera>
<gx:TimeStamp>
<when>2002-07-09T17:00:00-08:00</when>
</gx:TimeStamp>
<longitude>-122.444633</longitude>
<latitude>37.801899</latitude>
<altitude>139.629438</altitude>
<heading>-70.0</heading>
<tilt>75</tilt>
</Camera>
<Placemark>
<name>PM2009+</name>
<TimeSpan>
<begin>2009-01-01</begin>
</TimeSpan>
<Point>
<coordinates>-122.448425,37.802907,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
<script type="text/javascript">
var ge;
google.load("earth", "1");
function init() {
google.earth.createInstance('map3d', initCB, failureCB);
}
function initCB(instance) {
ge = instance;
ge.getWindow().setVisibility(true);
ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);
ge.getSun().setVisibility(true);
addKmlFromUrl('http://code.google.com/apis/earth/documentation/samples/time_example.kml');
}
function addKmlFromUrl(kmlUrl) {
var link = ge.createLink('');
link.setHref(kmlUrl);
var networkLink = ge.createNetworkLink('');
networkLink.setLink(link);
networkLink.setFlyToView(true);
ge.getFeatures().appendChild(networkLink);
}
function failureCB(errorCode) {
}
google.setOnLoadCallback(init);
</script>