In the past, you need modify rtc_api.c in mbed-dev source code. From this revision, you can just use RTC function all of conditions (Normal, Reset, Stand-by, Power OFF).

Note

From now on, you do NOT need any modification for mbed-dev library because STM team updates rtc_api.c source code and support RTC function under reset & standby condition includes power off condition (You need additional VBAT back-up hardware).

Please refer following NOTE information.
/users/kenjiArai/notebook/nucleo-series-rtc-control-under-power-onoff-and-re/

Revision:
6:5ada291037aa
Parent:
5:bc464a588c2e
Child:
7:27a1cf7f8921
--- a/main.cpp	Sat May 23 22:26:37 2015 +0000
+++ b/main.cpp	Fri Jan 29 07:51:04 2016 +0000
@@ -24,7 +24,7 @@
 //  Definition ------------------------------------------------------------------------------------
 #define SHOW_KEY_PROMPT     30
 
-#define USE_LCD
+//#define USE_LCD
 
 #if defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F411RE) \
  || defined(TARGET_NUCLEO_L152RE) || defined(TARGET_NUCLEO_F334R8)
@@ -36,10 +36,11 @@
 DigitalIn userSW(USER_BUTTON);
 DigitalOut myled(LED1);         // Indicate the sampling period
 Serial pc(USBTX, USBRX);
-#if defined(USE_LCD)
+//#if defined(USE_LCD)
 I2C i2c(D14,D15);               // SDA, SCL
 TextLCD_I2C_N lcd(&i2c, 0x7c, TextLCD::LCD8x2);  // LCD(Akizuki AQM0802A)
-#endif
+//#endif
+DigitalOut pwr_onoff(PA_9);
 
 //  RAM -------------------------------------------------------------------------------------------
 
@@ -58,6 +59,8 @@
     uint8_t wait_counter = 0;
     uint8_t xtal = 0;
 
+    pwr_onoff = 1;
+    wait(2.0);
 #if defined(USE_LCD)
     // lcd
     lcd.locate(0, 0);    // 1st line top