×
Namespaces

Variants
Actions

Internationalising timestamps in Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.


Article Metadata
Tested with
Devices(s): Nokia E61i
Nokia E90 Communicator
Nokia N95 8GB
Nokia 6220 Classic
Compatibility
Platform(s): S60 3rd Edition, MR
S60 3rd Edition, FP1
S60 3rd Edition, FP2 Beta
S60 3rd Edition FP2
S60 3rd Edition FP1
S60 3rd Edition (initial release)
Article
Keywords: TTime, TTime::FormatL()
Created: tapiolaitinen (04 Mar 2008)
Last edited: lpvalente (21 Jul 2012)

Contents

Overview

This code snippet is one of the series of snippets that demonstrate how to implement support for international diversity. This snippet shows how to format a timestamp according to the locale settings of the device.

Source file

// Buffer for localized text
TBuf<50> myBuf;
 
// Object for datetime data
TTime myTime;
 
// Set the date and time of myTime to the current datetime
myTime.HomeTime();
 
// Format the timestamp as date according to current locale settings
// The format string is universal, so whatever the locale is, the date is
// always formatted correctly (e.g. 03/03/2008)
myTime.FormatL(myBuf, _L("%/0%1%/1%2%/2%3%/3%X"));
 
// Format the timestamp as time according to current locale settings
// The format string is universal, so whatever the locale is, the time is
// always formatted correctly (e.g. 13:00 pm)
myTime.FormatL(myBuf, _L("%-B%:0%J%:1%T%:2%S%:3%+B"));

Postconditions

A timestamp is formatted according to the locale settings of the device.

See also

This page was last modified on 21 July 2012, at 23:09.
110 page views in the last 30 days.
×