date_and_time: Formatted Date and Time for File Names

View source: R/S03_Utilities.R

date_and_timeR Documentation

Formatted Date and Time for File Names

Description

Convenience function to generate a nicely formatted character string with the date and time, typically of the form: YYYY_MM_DD-HH_MM to include as part of a file name. Can convert the character string back into a date and time if needed.

Usage

date_and_time(value = NULL, frmt = "%Y_%m_%d-%H_%M")

Arguments

value

A character string to convert back into a date-time object.

frmt

A character string specifying the format for the date and time object (see as.POSIXct).

Value

Either 1) a character string with the date and time, to include in a file name, or 2) a date-time object.

Examples

string <- date_and_time()
string
# Convert back to date and time object
format( date_and_time( string ), '%Y-%m-%d %H:%M' )


rettopnivek/arfpam documentation built on Oct. 20, 2024, 7:24 p.m.