• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

DateSerial (to and from)

Hello,

I need a function that can convert a string to and from the dateserial format (including partial days - see examples below).

40490.6706944444
405250.68

And from (y/m/d h:m:s):

2009/01/01 00:00:01
2010/07/12 17:53:22

The dates are stored in a file so storing them via strings is what is desired if possible.

Thanks in advance for any assistance.
0
rite_eh
Asked:
rite_eh
  • 2
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
assuming you speak vb not .net:
dt2 = Format(dec, "yyyy/mm/dd hh:mm:ss")
0
 
HooKooDooKuCommented:
Format converts a date value to a string.
CDate can convert a string to a date.  However, the string much be a recogizable date.  If the string has extra text that doesn't include date information, then the CDate function throws an error.
0
 
rite_ehAuthor Commented:
What about converting from a standard date (ex. yyyy/mm/dd hh:mm:ss) to the serial date format, how could this be done?
0
 
rite_ehAuthor Commented:
I managed to perform the latter by using CDec(CDate("yyyy/mm/dd hh:mm:ss")) to give me the date/time in the decimal format. Thanks for the assistance.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now