how to set the current date and time as timestamp into a SM timestamp field

  • KM03128029
  • 22-Mar-2018
  • 02-Jun-2021

Summary

how to set the current date and time as timestamp into a SM timestamp field

Question

Use the now() function to set the current date and time as timestamp into a SM timestamp.

Example:

PifDateToTimezone(Now(),"Tokyo Standard Time", 0,"UTC", 0)

But it found that time could not be inserted into SM timestamp.

how to get the right current date/time for the SM timestamp field?!

Answer

timestamp format of now() is 03/09/18 04:40:12.977
the now() function for SQL timestamps, it can't use the format inserted into SM field.
it can use date() and time() function to get timestamps for SM
e.g.
----------------------------------------------------
Dim AcceptTime AS Date

AcceptTime= date() & " " & time()

RetVal = PifDateToTimezone(AcceptTime,"Tokyo Standard Time", 0,"UTC", 0)
----------------------------------------------------