Raynald's SPSS Tools
  • Syntax
    • SPSS Syntax Home
    • Sample Syntax Library
    • Learning Syntax
    • Debugging SPSS Syntax
    • Standard Data Files
  • Macros
    • SPSS Macros — Home
    • Sample Macro Library
    • Learning Macros
    • Debugging Macros
    • Kirill's SPSS Macros Page
  • Scripts
    • SPSS Scripts — Home
    • Sample Scripts Library
    • Learning Scripts
    • The Asynchronous Problem
  • Python
    • Python Scripts Home
    • Sample Python Library
  • R
    • R Scripts — Home
    • Sample R Library
  • Resources
    • Resources Overview
    • Blog
    • Links to SPSS (and not only SPSS) resources
    • SPSS Programming and Data Management Book
  • Sitemap
  • Feedback
  • en
    • Русский
    • Español
    • Portugues
    • Deutsch
    • Français
    • Italiano
  1. Home
  2. Syntax
  3. Sample Syntax Library
  4. Dates and time

Dates and time

(see also the Dates, Time and Age Tutorial at Learning Syntax page)

  • Add 60 days to a date then find end of that month
  • Add leading zeros to a string date
  • Ages are in nnH nnD nnM and nnA
  • Break down number of days in hospital by calendar month
  • Calculate age
  • Calculate time differences to milliseconds
  • Calculate mean date and standard deviation in days
  • Calculate nb of days within the eligibility period
  • Calculate number of minutes between 2 timestamps (crossover midnight)
  • Calculate number of months between 2 dates
  • Calculate waiting time when time is coded in hh min
  • Compute number of weekdays between 2 dates
  • Compute number of weekdays excluding public holidays
  • Compute sleep time
  • Convert string formatted as hhmmss into numeric time variable
  • Convert string 1997-08-22 into a date variable
  • Convert basis
  • Convert string"04Apri03" to a date variable
  • Convert string 01jan1992 to a date variable
  • Convert string into date and time variables
  • Convert strings into numbers
  • Date plus 3 months
  • Extract time portion from string variable containing date and time
  • From AM PM to military time
  • Importing from Excel (convert days into dates)
  • Keep time portion of date when creating Tab delimited file
  • Make variable equal to current date
  • Print date and time before a procedure
  • Number of consecutive 30 minutes of hypoxia
  • Print current date as part of graph title
  • Print day name along with date
  • Read time stamp
  • Save data file with current date as part of name
  • Select a range of dates
  • Time an SPSS procedure
  • Convert string to date and select cases which fall during the weekend
  • Convert Datetime String to Datetime Format Variable
  • Dates appear as asterisk on chart
Related pages

...

Navigate from here
  • Sample Syntax Library
  • Data validation
  • Export & Import
  • Add 60 days to a date then find end of that month
  • Get random page
  • Back to top

 


 

Raynald's SPSS Tools © 2001–2025, Raynald Levesque, Anton Balabanov. Click to learn more: About the project